Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Run Macro on multiple files

Hi Gary'' Student,

Your macro help me, but there is one more query that I have files in CSV and
when I run macro so all the times asking to save it Press Yes NO Cancel.

I want that all the files saves automaticall, without pressing YES for all
reports one by One.

Thanks

"Gary''s Student" wrote:

The following macro goes to the specified folder and lists the excel files in
that folder in column A.

The macro then goes down the list, opens each file, runs macroxx, and then
saves and closes the file:


Sub list_um()
Dim F As String
Dim roww As Long
roww = 0
Dim FileLocSpec As String
FileLocSpec = "C:\Temp\*.xls"
F = Dir(FileLocSpec)
Do Until F = ""
roww = roww + 1
Cells(roww, 1).Value = F
F = Dir
Loop

Set r = Range("A1")
While r.Value < ""
Workbooks.Open Filename:="C:\Temp\" & r.Value
Call macroxx
ActiveWorkbook.Save
ActiveWorkbook.Close
Set r = r.Offset(1, 0)
Wend
End Sub

--
Gary''s Student - gsnu200802


"LoriH" wrote:

I have an excel macro that I created to format a spreadsheet a certain way.
I want to run this macro on all the files in a specified folder. I am new to
macros and VBA. What is the easiest way to do this?

Thanks in advance!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying Multiple files in one file Macro - Liz Liz New Users to Excel 2 March 13th 07 02:45 PM
Macro: Filter Multiple header then extract to Multiple Files [email protected] Excel Discussion (Misc queries) 9 December 8th 06 10:44 PM
Run multiple excel files off of one macro. ahsya Excel Discussion (Misc queries) 5 October 4th 06 03:01 PM
Run multiple excel files off of one macro. ahsya Excel Worksheet Functions 1 October 3rd 06 11:43 PM
Macro for multiple open files [email protected] Excel Discussion (Misc queries) 1 February 13th 06 03:25 AM


All times are GMT +1. The time now is 06:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"