Hi, I want to specify a sheet with varible i. The reason I used i is that the code below is in a loop, I need to do something on Sheets("1"), Sheets("2") ... to Sheets("36") in turn:
i = wbkCur.Worksheets("Openwbk").Range("d6")
FileName = "C:\Users\Lele\" & i & ".xlsx"
Workbooks.Open(FileName:=FileName)
With Sheets(i)
.Rows("1:1").Insert Shift:=xlDown
......
End with
It gave the error of "Subscript out of range", at sentence "With Sheets(i)". Please help.
Thx,
Rachel
i = wbkCur.Worksheets("Openwbk").Range("d6")
FileName = "C:\Users\Lele\" & i & ".xlsx"
Workbooks.Open(FileName:=FileName)
With Sheets(i)
.Rows("1:1").Insert Shift:=xlDown
......
End with
It gave the error of "Subscript out of range", at sentence "With Sheets(i)". Please help.
Thx,
Rachel