通过查找定义打印区域后命名

时间:2019-02-25 16:26:44

标签: excel vba

我想通过特殊名称定义打印区域以供以后使用,例如With PrintVersion.Range("NewPrint")...。使用VBA设置后如何命名?

我的代码的一部分:

Dim PrintVersion As Worksheet

Set PrintVersion = ThisWorkbook.Worksheets("Print version")

PrintVersion.PageSetup.PrintArea = PrintVersion.Range("A1:C" & _
PrintVersion.[LOOKUP(2,1/(C1:C250<>""),ROW(C1:C250))]).Address

我已经尝试过这种方法,但是它似乎不起作用:

Dim PrintVersion As Worksheet

Set PrintVersion = ThisWorkbook.Worksheets("Print version")

PrintVersion.PageSetup.PrintArea = PrintVersion.Range("A1:C" & _
PrintVersion.[LOOKUP(2,1/(C1:C250<>""),ROW(C1:C250))]).Address

PrintVersion.PageSetup.PrintArea = "NewPrint"

0 个答案:

没有答案