通过改变变量PrintRow的值来设置不同的打印区域。方法二:用Names.Add方法。当在Excel中设置一个区域为打印区域后,Excel自动定义了一个名称“Print_Area",因而可以通过定义名称的方法来设置打印区域,代码如下:Sub SetPrintArea()Sheet1.Names.Add "Print_Area", Sheet1.Range("B2:G12")End Sub 设...
通过改变变量PrintRow的值来设置不同的打印区域。 方法二: 用Names.Add方法。当在Excel中设置一个区域为打印区域后,Excel自动定义了一个名称“Print_Area",因而可以通过定义名称的方法来设置打印区域,代码如下: Sub SetPrintArea() Sheet1.Names.Add "Print_Area", Sheet1.Range("B2:G12") End Sub 设置动态打...
一、设置打印区域 方法一: 用PageSetup.PrintArea属性。代码如下: Sub SetPrintArea()Sheet1.PageSetup.PrintArea = "A1:F15"End Sub 上述代码将区域A1:F15设置为打印区域。如果要同时设置多个打印区域,可以将上述代码改为: Sub SetPrin excel利用VBA设置或取消打印区域 如果需要用VBA代码在Excel工作表中设置打印区域,...
按下“Alt+F11”打开VBA编辑器。 在VBA编辑器中选择“插入”菜单下的“模块”选项。 在模块中输入以下代码: Sub SetPrintArea() Dim PrintArea As Range Set PrintArea = Selection ThisWorkbook.ActiveSheet.PageSetup.PrintArea = PrintArea.AddressEnd Sub 按下键盘上的F5键运行宏。 通过以上几种方法和技巧,您可以...
下面的VBA过程将生成从列A到列D的打印区域,而不管你是否更新数据,只要在列A至列D,都将包含在打印区域中。Sub PrintArea() Dim sh As Worksheet Set sh = Sheet1 With sh .PageSetup.PrintArea = _ .Range("A1", .Range("D" & Rows.Count).End(xlUp)).Address...
下面的VBA过程将生成从列A到列D的打印区域,而不管你是否更新数据,只要在列A至列D,都将包含在打印区域中。 代码语言:javascript 代码运行次数:0 SubPrintArea()Dim sh As Worksheet Set sh=Sheet1 With sh.PageSetup.PrintArea=_.Range("A1",.Range("D"&Rows.Count).End(xlUp)).Address ...
.PrintTitleColumns = "$A:$C" ' Set print title columns. .LeftHeader = "" ' Set the left header. ' More commands could appear before the End With. They are not ' shown here in order to keep the example short. End With ' End of With section. ...
下面的VBA过程将生成从列A到列D的打印区域,而不管你是否更新数据,只要在列A至列D,都将包含在打印区域中。Sub PrintArea() Dim sh As Worksheet Set sh = Sheet1 With sh .PageSetup.PrintArea = _ .Range('A1', .Range('D' & Rows.Count).End(xlUp)).Address End WithEnd Sub 上述代码将捕获列D中...
First, select the single or multiple cell range using the “Control” key to set a print area in the sheet. Afterward, go to the “Page Layout” tab and click the “Print Area” icon. In the print dropdown, click on the “Set Print Area”. And the moment you click on the option...
问Excel VBA设置打印区域并打印所有EN3.为了能够对颜色数据进行修改,我们首先需要点击右上角的save as ...