How to run specific macro on selected worksheet?

  • Thread starter Thread starter Harshad
  • Start date Start date
H

Harshad

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.
 
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
 
Dear Shane,

It's excellent. It's working.

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

Regards, Harshad
 
Back
Top