ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Passing an argument to a quote (https://www.excelbanter.com/excel-programming/272627-passing-argument-quote.html)

Zach

Passing an argument to a quote
 
Hi,

I have 140 (a1-a140) spreadsheets on which i am interested in
performing a particular task. I wrote a code to perform that task on a
single spreadsheet. Example below:


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

I now would like to incorporate the above code into a For next loop

For i = Startval To EndVal

My question is how do i rename the spreadsheet in "M:\My
Documents\a1.xls"
so it will take the values a1-a140 using the i counter. (Startval will
be 1 and endval will be 140).


Thanks for your help,
Zach

Myrna Larson[_2_]

Passing an argument to a quote
 
Of course that line goes inside a

For i = 1 to 140
Workbooks.Open ......

Next i

loop.



On Thu, 24 Jul 2003 19:33:56 -0700, "Ryan Poth" wrote:

Try:

Workbooks.Open Filename:= "M:\My Documents\a" & format
(i,"#")) & ".xls"



-----Original Message-----
Hi,

I have 140 (a1-a140) spreadsheets on which i am

interested in
performing a particular task. I wrote a code to perform

that task on a
single spreadsheet. Example below:


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

I now would like to incorporate the above code into a For

next loop

For i = Startval To EndVal

My question is how do i rename the spreadsheet in "M:\My
Documents\a1.xls"
so it will take the values a1-a140 using the i counter.

(Startval will
be 1 and endval will be 140).


Thanks for your help,
Zach
.




All times are GMT +1. The time now is 03:57 PM.

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