Hi,
there are a ton of ways to reference a sheet in vba, i'm partial to the sheet1, sheet2, etc. avoiding the name of the sheet. sheet(3) seems to return the third sheet in order of the workbook. I would like to reference with a for loop the sheet1 format. I tried sheeti, sheet i, etc. but couldnt' get something to work. I want it to be consistent for the sheet number assinged that we see in the vba editor and not relative to the sheet location or name assigned, but the hard 'name' assigned that doesn't change. Any thoughts how i would do that?
here is my sample code for looping through 15 sheets identified as Sheet1 through 15:
I hope this makes sense. Any thoughts would be greatly appreciated. Thanks all!
there are a ton of ways to reference a sheet in vba, i'm partial to the sheet1, sheet2, etc. avoiding the name of the sheet. sheet(3) seems to return the third sheet in order of the workbook. I would like to reference with a for loop the sheet1 format. I tried sheeti, sheet i, etc. but couldnt' get something to work. I want it to be consistent for the sheet number assinged that we see in the vba editor and not relative to the sheet location or name assigned, but the hard 'name' assigned that doesn't change. Any thoughts how i would do that?
here is my sample code for looping through 15 sheets identified as Sheet1 through 15:
Code:
For i = 1 To 15
Sheet ?????.Select '<-here is where i'm not sure how to reference how i'd like as described above
Cells(1, 1).value = "testing" & i
Next i
end sub