Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 44
Default What to do to run macro on sheet1 to sheet10

I have macro, which i want to run on sheet1 to sheet10 by one go.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 747
Default What to do to run macro on sheet1 to sheet10

try this

Sub all_sheet()
Dim ws As Workbook
For x = 1 To Worksheets.Count
Sheets(x).Select
'your code........
Next
End Sub




On Oct 17, 3:53*pm, Harshad wrote:
I have macro, which i want to run on sheet1 to sheet10 by one go.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default What to do to run macro on sheet1 to sheet10

How about something like this? This assumes that you want to do something to
every sheet. If you don't, let me know.

Sub Test()
Dim WS As Worksheet
Dim WB As Workbook

For Each WS In WB.Worksheets
Call PerformStuff(WS)
Next WS

End Sub

Sub PerformStuff(WS As Worksheet)

'Put your "stuff" in here

WS.Cells(1, 1).Value = 1

End Sub
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Harshad" wrote:

I have macro, which i want to run on sheet1 to sheet10 by one go.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default What to do to run macro on sheet1 to sheet10

I forgot to include this

Set WB = ActiveWorkbook
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Harshad" wrote:

I have macro, which i want to run on sheet1 to sheet10 by one go.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default What to do to run macro on sheet1 to sheet10

This will perform on sheets as they are arranged in the workbook. Post YOUR
code for comments along with which 10 sheets you want. Or, do you only have
10 sheets? More detail.

Sub doeachsheet()
For i = 1 To 3
MsgBox Sheets(i).Name
MsgBox Sheets(i).Range("a1")
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Harshad" wrote in message
...
I have macro, which i want to run on sheet1 to sheet10 by one go.




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 44
Default What to do to run macro on sheet1 to sheet10

Daer all,

My workbook cointain54 sheets. i don't want to run all the macro to each
sheet.
Some descreption:
Sheet names in ascending order a Main, Content, Micro, Help, NN1,
NN2,....,NN50.
I have macros name: Main, Content, Micro1, Micro2, Help, NNA, NNB, NNC.
I have solved to run Main, Content, Micro and Help macro by following code.

Sheets("Sheet Name").Activate

But problem is for remaining Three Macro NNA, NNB and NNC.
NNA, NNB and NNC are
What i should put in a code, that runs my all three NN* macro through sheet
NN1 to NN50.


"Harshad" wrote:

I have macro, which i want to run on sheet1 to sheet10 by one go.

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
Macro to Copy data from a list in sheet1 and paste into sheet2 Michael Excel Discussion (Misc queries) 3 April 23rd 08 06:52 PM
[=Sheet1!A1] - if i use Column A1 ('Sheet1') / A2 ('Sheet2') Lawrence C H Tan Excel Worksheet Functions 0 January 19th 07 09:29 PM
Using Macro, want to group all Worksheets, but Sheet1,How? Dandelo Excel Discussion (Misc queries) 3 July 20th 06 04:26 PM
Macro-Copy various cells in sheet1 into next available row in sheet 2 lunker55 Excel Discussion (Misc queries) 7 October 21st 05 11:05 PM
Modifying Sheet1 macro to run on Sheet2 Sharon Excel Discussion (Misc queries) 6 April 28th 05 01:21 PM


All times are GMT +1. The time now is 04:15 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"