G
gatarossi
Dear all,
I have a lot of sheets in my workbook and I need to run the same code
in each sheet, but one variable of my VBA code is exactly the name of
the sheet.
I have a sheet with the name of all sheets that I will use:
For example:
A
1 dog
2 cat
3 fish
Then I'm trying to create a variable with the name of the sheet:
Sub test()
Dim xlsht As Excel.Worksheet
Dim xlsht2 As Excel.Worksheet
prodline = xlsht2.Cells(2, 1)
Set xlsht = Sheets(prodline)
xlsht.Select
End Sub
But it doesn't work!!!!
How can I do it???
Thanks a lot!!!
I have a lot of sheets in my workbook and I need to run the same code
in each sheet, but one variable of my VBA code is exactly the name of
the sheet.
I have a sheet with the name of all sheets that I will use:
For example:
A
1 dog
2 cat
3 fish
Then I'm trying to create a variable with the name of the sheet:
Sub test()
Dim xlsht As Excel.Worksheet
Dim xlsht2 As Excel.Worksheet
prodline = xlsht2.Cells(2, 1)
Set xlsht = Sheets(prodline)
xlsht.Select
End Sub
But it doesn't work!!!!
How can I do it???
Thanks a lot!!!