Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 44
Default How to run specific macro on selected worksheet?

I have 54 sheet workbook. The name of the sheets from begining are Main,
Content, solvent, Help, Exp 1, Exp 2, Exp 3,Exp 4,.....,Exp 50.

I have one NNA code, which i want to run on sheets named Exp 1 to Exp 50.

Pls sugest code.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,344
Default How to run specific macro on selected worksheet?

Hi,

I suppose I should know what NNA code is but I don't. However, if you are
asking how do you run code against all sheets whose name begins with Exp then
you might use something like this

Sub Test()
Dim I As Integer
For I = 1 To 50
Sheets("Exp " & I).Activate

'Your code here....

Next I
End Sub

If this helps, please click Yes
--
Thanks,
Shane Devenshire


"Harshad" wrote:

I have 54 sheet workbook. The name of the sheets from begining are Main,
Content, solvent, Help, Exp 1, Exp 2, Exp 3,Exp 4,.....,Exp 50.

I have one NNA code, which i want to run on sheets named Exp 1 to Exp 50.

Pls sugest code.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 44
Default How to run specific macro on selected worksheet?

Dear Shane,

It's excellent. It's working.

Thank you very much. You solved my problem.
Please continue the good work.

Regards, Harshad

"ShaneDevenshire" wrote:

Hi,

I suppose I should know what NNA code is but I don't. However, if you are
asking how do you run code against all sheets whose name begins with Exp then
you might use something like this

Sub Test()
Dim I As Integer
For I = 1 To 50
Sheets("Exp " & I).Activate

'Your code here....

Next I
End Sub

If this helps, please click Yes
--
Thanks,
Shane Devenshire


"Harshad" wrote:

I have 54 sheet workbook. The name of the sheets from begining are Main,
Content, solvent, Help, Exp 1, Exp 2, Exp 3,Exp 4,.....,Exp 50.

I have one NNA code, which i want to run on sheets named Exp 1 to Exp 50.

Pls sugest code.

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
make a macro 'worksheet specific' Lori Excel Discussion (Misc queries) 11 October 29th 07 12:38 AM
Repeating a Macro For Each Selected Worksheet carl Excel Worksheet Functions 0 January 11th 06 10:07 PM
Help with a macro to open to a specific worksheet EAHRENS Excel Worksheet Functions 0 November 30th 05 08:36 PM
Macro to print a selected range, not entire worksheet James C Excel Discussion (Misc queries) 3 October 19th 05 10:12 PM
How to run a macro when a worksheet is selected cpmittal Excel Worksheet Functions 2 July 27th 05 11:57 AM


All times are GMT +1. The time now is 07:32 AM.

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"