ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Moving on to the next tab in a macro (https://www.excelbanter.com/excel-discussion-misc-queries/253754-moving-next-tab-macro.html)

Wombat

Moving on to the next tab in a macro
 
Hello!

Is there any way to write into a macro that it should search through several
sheets in a workbook? For eg, loop it to do a search in tab one and then move
on to search tab 2 when its finished?

Thanks for any help

Don Guillett

Moving on to the next tab in a macro
 
A looping macro for each sheet to search and end the macro when found.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Wombat" wrote in message
...
Hello!

Is there any way to write into a macro that it should search through
several
sheets in a workbook? For eg, loop it to do a search in tab one and then
move
on to search tab 2 when its finished?

Thanks for any help



Jim Thomlinson

Moving on to the next tab in a macro
 
code something like this will do it...

dim wks as worksheet

for each wks in worksheets
msgbox wks.name
next wks

Note that we are referencing wks and not the active sheet as the above code
does not activate the sheets. If you are intending to use this with a
recorded amcro then add wks.select to your code.
--
HTH...

Jim Thomlinson


"Wombat" wrote:

Hello!

Is there any way to write into a macro that it should search through several
sheets in a workbook? For eg, loop it to do a search in tab one and then move
on to search tab 2 when its finished?

Thanks for any help



All times are GMT +1. The time now is 06:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com