T
tedd13
I have a workbook with one sheet, that I will call the "master sheet". It
contains all my data. I am selecting a row from this master sheet, opening a
new sheet, and pasting my data from the master sheet to this new sheet.
I then take the value of a cell in the new sheet and use that value for the
sheet name. For example, a cell may contain the value '50'. So '50' becomes
the sheet name. I use this code:
Dim sheetName
sheetName = ActiveCell.Value
Sheets("Sheet1").Select
Sheets("Sheet1").Name = sheetName
This works. I then go back to the master sheet and select another row.
What I want to do then is to go back to the sheet I just created by using the
variable 'sheetName' (this name may change, that's why I want to use the
variable).
I tried using something like: Sheets 'sheetName'.Select or Sheets
(sheetName).Select. But it errors out because of sheetName. When I mouse
over sheetName in the macro it gives me the value of the new sheet. So I
know it has the correct value in it.
Is there a way of doing this? Thanks.
contains all my data. I am selecting a row from this master sheet, opening a
new sheet, and pasting my data from the master sheet to this new sheet.
I then take the value of a cell in the new sheet and use that value for the
sheet name. For example, a cell may contain the value '50'. So '50' becomes
the sheet name. I use this code:
Dim sheetName
sheetName = ActiveCell.Value
Sheets("Sheet1").Select
Sheets("Sheet1").Name = sheetName
This works. I then go back to the master sheet and select another row.
What I want to do then is to go back to the sheet I just created by using the
variable 'sheetName' (this name may change, that's why I want to use the
variable).
I tried using something like: Sheets 'sheetName'.Select or Sheets
(sheetName).Select. But it errors out because of sheetName. When I mouse
over sheetName in the macro it gives me the value of the new sheet. So I
know it has the correct value in it.
Is there a way of doing this? Thanks.