Board logo

標題: [發問] 指定A欄第1列有資料之範圍設定列印範圍問題請教 [打印本頁]

作者: rouber590324    時間: 2016-6-30 14:53     標題: 指定A欄第1列有資料之範圍設定列印範圍問題請教

DEAR ALL 大大'
1.需求 : 指定A欄第1列有資料之範圍設定列印範圍問題請教
1.1如下 A欄可用 R = Sheet1.[A65536].End(xlUp).Row 找到最後一列之值代入
1.2但 第1列用  F = Sheet1.Cells(1, Columns.Count).End(xlToLeft).Column() 找到是數字
  1.1.2 請教 ActiveSheet.PageSetup.PrintArea = "$A$1:$I" & R    之 I如何處理??
1.3 煩不吝賜教. THANKS*10000

Sub A()
Sheet1.Select
Range("A1").Select
R = Sheet1.[A65536].End(xlUp).Row
F = Sheet1.Cells(1, Columns.Count).End(xlToLeft).Column()
ActiveSheet.PageSetup.PrintArea = "$A$1:$I" & R
Range("A1").Select
End Sub
作者: rouber590324    時間: 2016-7-1 08:23

DEAR  ALL 大大
1.小弟目前用如下方式勉強克服(先寫到R).但要寫 A-IV 太長啦
GetChoice = Choose(F, "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "", "Q", "R")

Sub A()
Sheet1.Select
  Range("A1").Select
  R = Sheet1.[A65536].End(xlUp).Row
  F = Sheet1.Cells(1, Columns.Count).End(xlToLeft).Column()
  GetChoice = Choose(F, "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "", "Q", "R")
  ActiveSheet.PageSetup.PrintArea = "$A$1" & GetChoice & R
Range("A1").Select
End Sub
作者: jackyq    時間: 2016-7-1 08:41

回復 2# rouber590324


    大大 不用作苦工啊


GetChoice = Left(Cells(1, F).Address(0, 0) , Len( Cells(1, F).Address(0, 0) ) - 1)
作者: rouber590324    時間: 2016-7-1 09:56

DEAR jackyq 大大
非常感謝您.OK啦 THANKS*10000




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)