What you've described is confusing.
But, let me explain how to loop through sheets and execute a macro for each 
sheet:

Assuming you want to process ALL sheets in the workbook:

Sub Process_All_Sheets()
  For Sht = 1 to Sheets.Count
      sheets(sht).select
      Execute_Changes
  Next Sht
End Sub
 
Sub Execute_Changes()
   Range("H2").Value = "abc"
End Sub

Depending on how extensive your changes are,
you don't really need to "select" the sheet

YOu could:
For Sht = 1 to Sheets.Count
  Sheets(Sht).Range("H2").Value = "abc"
Next Sht

Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------




________________________________
From: Rajesh thrissur <rajeshkainikk...@gmail.com>
To: excel-macros <excel-macros@googlegroups.com>
Sent: Fri, February 8, 2013 12:00:44 AM
Subject: $$Excel-Macros$$ For loop syntax for working same macro in all 
worksheets

Hi experts,
Please check the macro here ,my workbook have 31 sheets each page
represents particular days in the month.I want work the macro in all
the pages one by one . I don't know how to write a loop for this,
Kindly help me.

Sub Macro1()
    Range("H2").Select
    ActiveCell.FormulaR1C1 = "abc"
    Range("H3").Select
End Sub
Sub Macro2()
  For i = Worksheets(1) To Worksheets(31)
  Application.Run "'New Microsoft Office Excel Worksheet.xlsx'!Macro1"
    ActiveSheet.Next.Select
  Next i
End Sub

With regards
Rajesh kainikkara

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to