LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to create Loop

I'm betting that your recorded macro works against the activesheet.

So right after your loop starts, you can select the worksheet.

Dim wks as worksheet
for each wks in activeworkbook.worksheets
wks.select
'your recorded code
next wks

Better yet would be to fully qualify each range/object that you use in your code
and not have to select the worksheet.

Dim wks as worksheet
for each wks in activeworkbook.worksheets
wks.range("a1").clearcontents
wks.range("c3:d9").copy _
destination:=wks.range("x99")
next wks

Sandeep P wrote:

I have recorded a macro to delete some row and then move to next sheet and
perform the same action on the next sheet also until all the sheets are done.

but it works fine for 1st sheet and does not work for sheets further.

How can we run the same recorded macro in loop so that it performs the same
action on all sheets

Could you please help


--

Dave Peterson
 
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
Create a loop stephenc Excel Discussion (Misc queries) 4 January 12th 09 03:54 PM
(Complex) Loop within loop to create worksheets klysell Excel Programming 1 March 20th 07 12:03 AM
create a loop Ivano Excel Programming 0 April 18th 06 06:01 PM
Using Loop to create Array davidm Excel Programming 4 June 15th 05 11:41 AM
How do I create a For loop within a For loop? Linking to specific cells in pivot table Excel Programming 2 January 24th 05 08:05 AM


All times are GMT +1. The time now is 10:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"