Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
carl
 
Posts: n/a
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John Michl
 
Posts: n/a
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John Michl
 
Posts: n/a
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Setup for multiple worksheets macro problem KonaAl Excel Discussion (Misc queries) 3 January 7th 06 03:33 AM
Macro Help In Excel welshlad Excel Discussion (Misc queries) 14 October 26th 05 02:34 PM
Macro to repeat formulas in next row katiekay Excel Discussion (Misc queries) 5 February 10th 05 09:28 PM
How to program an excel macro to repeat a series of keystrokes? Beancounter Excel Discussion (Misc queries) 8 January 23rd 05 12:51 AM
Macro with Range of Worksheets Chris E. New Users to Excel 8 December 3rd 04 05:56 PM


All times are GMT +1. The time now is 08:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"