![]() |
Loops with sheet codenames
I am trying to create a loop in code that does the same commands on multiple worksheets and I want to refer to each sheet using their codename so that it will still work if someone changes the worksheet name on the tab.
Something along these lines. for p = 2 to 6 name = "sheet" & p ARow = name.Cells(Rows.Count, "B").End(xlUp).Row etc next p I know that doesn't work so I need help with the code and how to dimension the variables. To clarify how I would like it to work it should end up doing ARow = sheet2.Cells(Rows.Count, "B").End(xlUp).Row when p = 2 Can this be done. Thanks |
All times are GMT +1. The time now is 09:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com