This is my current VBA code. I would like to make the week number to increase by 1 every week. (so UAE_WK_2)
Sub HelloALL3()
Application.Run "PERSONAL.XLSB!Hello12"
Windows("UAE_WK_1.xlsm").Activate
Application.Run "PERSONAL.XLSB!Hello13"
Windows("UAE_WK_1.xlsm").Activate
Application.Run "PERSONAL.XLSB!Hello14"
Windows("UAE_WK_1.xlsm").Activate
Application.Run "PERSONAL.XLSB!Hello15"
Windows("UAE_WK_1.xlsm").Activate
Application. Run "PERSONAL.XLSB!Hello16"
End Sub
You can use simple loop for week number
Sub test()
Dim weekNum As Integer
For weekNum = 1 To 4
Application.Run "PERSONAL.XLSB!Hello12"
Windows("UAE_WK_" & weekNum & ".xlsm").Activate
Next weekNum
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.