Execute code in a loop - Question

  • Thread starter Thread starter Les
  • Start date Start date
L

Les

Hello all, i am not a programmer so forgive the type of questions. Is it
possible to run code to manipulate a document if it is opened within a loop
and once finished the loop continues ?
 
Hi Les, yes it is:

sub demo()

dim wb as work book
dim s as string
dim i as integer

s= "C:\Filepath\File.xls"

for i = 1 to 10
Set wb = Workbooks.Open(s, False)

'Write your code in here

wb.Close
next i

end sub
 
Thanks Sam, much appreciated
--
Les


Sam Wilson said:
Hi Les, yes it is:

sub demo()

dim wb as work book
dim s as string
dim i as integer

s= "C:\Filepath\File.xls"

for i = 1 to 10
Set wb = Workbooks.Open(s, False)

'Write your code in here

wb.Close
next i

end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top