Modify a Macro to Repeat for all Selected Worksheets
I use this macro to help name ranges.
Sub maketable() Range("B19").Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select ActiveWorkbook.Names.Add Name:=Application.InputBox("Enter Table Name") End Sub Is it possible to modify it so that it will run on all selected worksheets (I select the worksheet via ctrl left click. Thank you in advance. |
Modify a Macro to Repeat for all Selected Worksheets
This should do the trick. - John Michl
Sub maketable() Set SheetList = ActiveWindow.SelectedSheets For Each sh In SheetList sh.Activate Range("B19").Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select ActiveWorkbook.Names.Add Name:=Application.InputBox("Enter Table Name") Next sh End Sub |
Modify a Macro to Repeat for all Selected Worksheets
Forgot to mention that in the future, post macro questions in the
"programming" group since that's where the VBA pros hang out. - John |
All times are GMT +1. The time now is 04:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com