Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Repeat code for multiple worksheets

Hi.

I have a set of code that I have written to execute on one worksheet of a
workbook. There are about 15 different worksheets in this workbook.

I need to have this code excecuted for all but 2 of the worksheets.

Is there a way I can loop the code so that I don't have to rewrite it for
each worksheet. Note that the two I do not need this run on are the last two
worksheets in the workbook.

Thanks,
Mike.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Repeat code for multiple worksheets

Mike

I have no idea if your code will work on different sheets because you may
have sheet names in the code but this loops through all sheets except the
last 2

For x = 1 To Worksheets.Count - 2
'your macro
Next

Mike

"Mike" wrote:

Hi.

I have a set of code that I have written to execute on one worksheet of a
workbook. There are about 15 different worksheets in this workbook.

I need to have this code excecuted for all but 2 of the worksheets.

Is there a way I can loop the code so that I don't have to rewrite it for
each worksheet. Note that the two I do not need this run on are the last two
worksheets in the workbook.

Thanks,
Mike.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Repeat code for multiple worksheets

This works great, Mike H. I just have the first statement be:

Sheets(x).select

Thanks!

"Mike H" wrote:

Mike

I have no idea if your code will work on different sheets because you may
have sheet names in the code but this loops through all sheets except the
last 2

For x = 1 To Worksheets.Count - 2
'your macro
Next

Mike

"Mike" wrote:

Hi.

I have a set of code that I have written to execute on one worksheet of a
workbook. There are about 15 different worksheets in this workbook.

I need to have this code excecuted for all but 2 of the worksheets.

Is there a way I can loop the code so that I don't have to rewrite it for
each worksheet. Note that the two I do not need this run on are the last two
worksheets in the workbook.

Thanks,
Mike.

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
Information from multiple worksheets to repeat on a single one Steve, Blackpool Excel Discussion (Misc queries) 1 September 7th 09 02:00 PM
Repeat same data entry to multiple worksheets without Group Functi vstar Excel Discussion (Misc queries) 1 July 9th 08 08:32 PM
Code for multiple worksheets Paul S Excel Discussion (Misc queries) 1 June 17th 08 12:50 PM
Repeat printing rows in multiple worksheets KevinG Excel Discussion (Misc queries) 19 November 27th 07 10:42 PM
Delete Blank Rows Code - Multiple Worksheets - Multiple Documents BenS Excel Discussion (Misc queries) 3 June 29th 07 12:20 AM


All times are GMT +1. The time now is 10:09 AM.

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"