View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Zach Zach is offline
external usenet poster
 
Posts: 2
Default Passing an argument to a quote

I have 140 spreadheets a1-a140.
I am interested in performing a task on each of them. I created a
macro that performs the task on 1 spreadheet.

I now would like to put this task in a For Next loop and be able to
make the counter run between 1-140

Here is a snippet:

For i = Startval To EndVal

Workbooks.Open Filename:= _
"M:\My Documents\Projects\a1.xls"
Rows("1:1").Select
Selection.Delete Shift:=xlUp


My question: what is the appropriate syntax to change a1.xls to
a(i).xls so my spreadheet name will change automatically to a1-a140?

Thanks for your help
Zachh