打开excel根据条件决定是否自动执行宏 求vba宏代码

2024-11-06 08:14:49
推荐回答(2个)
回答(1):

Private Sub Workbook_Open()
With Sheets(1)
If WorksheetFunction.CountA(.Range("a:a")) = 0 Then Call macro
ThisWorkbook.Save
If Hour(Time) >= 1 And Hour(Time) <= 15 Then ThisWorkbook.Close
End With
End Sub

回答(2):

具体 根据什么条件? 比如 A1 =1 则执行程序?