|
- Sub 打印()
- If Sheets("Sheet2").[D15] = "" Then MsgBox "D15,不为空!": Exit Sub
- Dim c As Range
- With Sheet1
- Set c = .UsedRange.Find(Sheet1.[D15], , , 1)
- If Not c Is Nothing Then
- .PageSetup.PrintArea = .Range(.Cells(1, 1), .Cells(c.Row + 53, c.Column + 8)).Address
- .PrintOut
- End If
- End With
- End Sub
复制代码 我在Sheet2表设一个按钮打印
单元格D15不为空时打印
为空时不能打印
以上功能可实现
可是打印出来的不是我要的
我要的是Sheet2表的数据
不是Sheet1表的数据
对了 我的表 名称要是中文字 那要如何改
菜鸟不懂 打印 也是抓来的
请老师帮修改
谢谢
- Sub 打印()
- If Sheets("Sheet2").[D15] = "" Then MsgBox "D15,不为空!": Exit Sub
- Dim c As Range
- With Sheets("Sheet2")
- Set c = .UsedRange.Find(.[D15], , , 1)
-
- If Not c Is Nothing Then
-
- .PageSetup.PrintArea = .Range(.Cells(1, 1), .Cells(c.Row + 53, c.Column + 8)).Address
-
- .PrintOut
-
- End If
- End With
- End Sub
复制代码
|
|