View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Execute VB code against certain open workbooks

Try code something like this...

sub test()
dim wbk as workbook

for each wbk in workbooks
msgbox wbk.name
next wbk
end sub
--
HTH...

Jim Thomlinson


"JDaywalt" wrote:

I have a 'Master' file that contains code in which I need to access other
open files and perform a subset of code against each of them. The possible
number of open files is anywhere from 1 to 12---and each of the files will be
named sequentially Book1, Book2, Book3, etc. as they will have been generated
from a previous 'Copy Sheet' process performed by the user. How can I write
my code such that it identifies the number of these "Books" that are open,
then loops through each of them (performing the addt'l code), then stopping
when it reaches the last open book?