vba实用操作代码(打印工作表)

叫我瞄大人

hetong文件下打印所有"专项经费使用范围"工作表

Sub Macro1()
  Dim fn As String, wb As Workbook, ws As Worksheet, i As Long
  fn = Dir("C:\Users\fuxingyu\Desktop\hetong\*.xlsx")
  Do While fn <> ""
    Set wb = Workbooks.Open("C:\Users\fuxingyu\Desktop\hetong\" & fn)
    For Each ws In wb.Worksheets
        If Right(Trim(ws.Range("A1")), 8) = "专项经费使用范围" Then
            ws.PrintOut copies:=1
        End If
    Next ws
    wb.Close
    fn = Dir
  Loop
  
  End Sub
阅读 1.5k

个人编程学习
python,matlab,VB

喜欢追星的非科班的编程爱好者

458 声望
74 粉丝
0 条评论

喜欢追星的非科班的编程爱好者

458 声望
74 粉丝
文章目录
宣传栏