Sub works()
Dim i As Integer, c As Range, j As Integer
Dim WkbPath As String
Dim wkb As Workbook
For j = 9 To 100
For i = 209 To 300
WkbPath = "C:\CALCULATIONS\FIRST - Copy (2)\CAL" & j & "\CALCULATIONS.xlsx" ' Change this to your path
Workbooks.Open WkbPath
Set wkb = ActiveWorkbook
Set c = wkb.Sheets("Sheet1").Range("C4")
c.Value = i
ActiveWorkbook.Close SaveChanges:=True
Next i
Next j
'shutdown.exe will NOT work on Windows 95, 98, 98 SE and ME
ActiveWorkbook.Save
Application.DisplayAlerts = False
Application.Quit
'//shut down the computer
Shell "shutdown -s -t 02", vbHide
End Sub
Hi,
The above code is required to end running after j reaches to 100 and i reaches to 300, but even after i=300 & j=100 the code again operates from the begining.
Are there any modifications to be done for the code to stop Lopping, after reaching the maximum values of i & j?
Thank you
Bookmarks