G
Guest
I only write VBA once in a blue moon and so I am probably asking the obvious
I want to use a list of sheetnames (that will grow over time) held in the "companies" sheet ,cells b1 to b?? to pass control to a routine that selects each sheet in turn, carries out some code and then selects the next sheet...
Obviously I can do this using a routine to find the row of the last name in column B and then a LOOP
Sub WSheetSelectL(
' selects each sheet name down the list & activates that shee
Sheets("companies").Selec
Range("b1").Offset(1, 0).Selec
Do While Not IsEmpty(ActiveCell
Nrow = (ActiveCell.Row
Sname$ = Cells(Nrow, 2
' passes the sheet name to a routine that executes more code on the named shee
Sheets("companies").Selec
ActiveCell.Offset(1, 0).Selec
Loo
End Sub
However, I am sure that I could use an array and be a lot neater/efficient. Trying this has brought me to the limit of my knowledge, I can populate the array from the cells, but can I use it? Can I h**l
CAN ANYONE SUGGEST A WAY
I want to use a list of sheetnames (that will grow over time) held in the "companies" sheet ,cells b1 to b?? to pass control to a routine that selects each sheet in turn, carries out some code and then selects the next sheet...
Obviously I can do this using a routine to find the row of the last name in column B and then a LOOP
Sub WSheetSelectL(
' selects each sheet name down the list & activates that shee
Sheets("companies").Selec
Range("b1").Offset(1, 0).Selec
Do While Not IsEmpty(ActiveCell
Nrow = (ActiveCell.Row
Sname$ = Cells(Nrow, 2
' passes the sheet name to a routine that executes more code on the named shee
Sheets("companies").Selec
ActiveCell.Offset(1, 0).Selec
Loo
End Sub
However, I am sure that I could use an array and be a lot neater/efficient. Trying this has brought me to the limit of my knowledge, I can populate the array from the cells, but can I use it? Can I h**l
CAN ANYONE SUGGEST A WAY