![]() |
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. |
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. |
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. |
All times are GMT +1. The time now is 05:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com