ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Modified "For Each wbk In Application.Workbooks" (https://www.excelbanter.com/excel-programming/375583-modified-each-wbk-application-workbooks.html)

markx

Modified "For Each wbk In Application.Workbooks"
 
Hello there,

One more "telegraphical" question...

If I want to make changes in all open workbooks, I use something like:

For Each wbk In Application.Workbooks
<do something
Next wbk

Now, my question is:
how to write the macro that will <do something on all the open workbooks
except the one from which the macro is executed?

Many thanks for your help on this,
Mark



Tom Ogilvy

Modified "For Each wbk In Application.Workbooks"
 
For Each wbk In Application.Workbooks
if wbk.Name < thisworkbook.Name then
<do something
end if
Next wbk

--
Regards,
Tom Ogilvy



"markx" wrote:

Hello there,

One more "telegraphical" question...

If I want to make changes in all open workbooks, I use something like:

For Each wbk In Application.Workbooks
<do something
Next wbk

Now, my question is:
how to write the macro that will <do something on all the open workbooks
except the one from which the macro is executed?

Many thanks for your help on this,
Mark




markx

Modified "For Each wbk In Application.Workbooks"
 
Thanks Tom...
Next time I should think more by myself...

"Tom Ogilvy" wrote in message
...
For Each wbk In Application.Workbooks
if wbk.Name < thisworkbook.Name then
<do something
end if
Next wbk

--
Regards,
Tom Ogilvy



"markx" wrote:

Hello there,

One more "telegraphical" question...

If I want to make changes in all open workbooks, I use something like:

For Each wbk In Application.Workbooks
<do something
Next wbk

Now, my question is:
how to write the macro that will <do something on all the open workbooks
except the one from which the macro is executed?

Many thanks for your help on this,
Mark







All times are GMT +1. The time now is 03:58 AM.

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