close

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

全站熱搜
創作者介紹
創作者 software 的頭像
software

software

software 發表在 痞客邦 留言(0) 人氣()