markman235
New Member
- Joined
- May 10, 2011
- Messages
- 46
Hi everyone,
I have a macro that creates a new tab every time it runs. I have another macro to later delete that new tab, but I can't get it to reference the active sheet rather than the sheet name.
Here is the Macro that I have by using the record macro function. The current sheet on here is "Sheet5", but I just need it to reference the active sheet.
Cells.Select
Cells.EntireColumn.AutoFit
Rows("1:1").Select
Selection.AutoFilter
Range("B5").Select
Sheets("Sheet5").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Macro paste").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Summary").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Vendors").Select
ActiveWindow.SelectedSheets.Visible = False
Range("B2").Select
End Sub
You guys are the best!!
Mark
I have a macro that creates a new tab every time it runs. I have another macro to later delete that new tab, but I can't get it to reference the active sheet rather than the sheet name.
Here is the Macro that I have by using the record macro function. The current sheet on here is "Sheet5", but I just need it to reference the active sheet.
Cells.Select
Cells.EntireColumn.AutoFit
Rows("1:1").Select
Selection.AutoFilter
Range("B5").Select
Sheets("Sheet5").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Macro paste").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Summary").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Vendors").Select
ActiveWindow.SelectedSheets.Visible = False
Range("B2").Select
End Sub
You guys are the best!!
Mark
Last edited: