I use this macro to help name ranges.
Sub maketable()
Range(quot;B19quot;).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
ActiveWorkbook.Names.Add Name:=Application.InputBox(quot;Enter Table Namequot;)
End SubIs 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.
This should do the trick. - John Michl
Sub maketable()
Set SheetList = ActiveWindow.SelectedSheets
For Each sh In SheetList
sh.Activate
Range(quot;B19quot;).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
ActiveWorkbook.Names.Add Name:=Application.InputBox(quot;Enter Table
Namequot;)
Next sh
End SubForgot to mention that in the future, post macro questions in the
quot;programmingquot; group since that's where the VBA pros hang out.
- John
- Apr 13 Sun 2008 20:43
Modify a Macro to Repeat for all Selected Worksheets
close
全站熱搜
留言列表
發表留言