Thread: Generic Macro
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Generic Macro

First store the location/filenames in column A:

In A1:

C:\Temp\1.xls

and then also fill-in A2 thru A50

Then:

Sub dural()
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To n
fl = Cells(i, 1).Value
Workbooks.Open (fl)
Sheets("Sheet1").Activate
Range("B9").Value = Date
ActiveWorkbook.Save
ActiveWorkbook.Close
Next
End Sub


This particular example puts the date in B9 of Sheet1 of each file.
--
Gary''s Student - gsnu201001


"WildWill" wrote:

I have a range of files stored in the same location/sub-directory, and I need
to make the same change to each one of the files. How do I achieve this by
using a Macro? My files are named 1.xls, 2.xls....50.xls