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.
|
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. |
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. |
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. |
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. |
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. |
What to do to run macro on sheet1 to sheet10
A mod on what I gave you on the post to create the sheets
Sub runsheets() On Error Resume Next For i = 1 To 3 MsgBox Sheets("NN" & i).Range("a1") 'do your thing here. selections\activations NOT necessary Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Harshad" wrote in message ... 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. |
All times are GMT +1. The time now is 06:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com