Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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! |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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! |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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! |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This worked great. I was getting an error message at first but added a
msgbox to tell me when the files were all formatted and it went away. Thansk! "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! |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi LoriH,
Kindly help me, where I have to write this macro? I have same issue please help me to write this macro. Thanks "LoriH" wrote: This worked great. I was getting an error message at first but added a msgbox to tell me when the files were all formatted and it went away. Thansk! "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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying Multiple files in one file Macro - Liz | New Users to Excel | |||
Macro: Filter Multiple header then extract to Multiple Files | Excel Discussion (Misc queries) | |||
Run multiple excel files off of one macro. | Excel Discussion (Misc queries) | |||
Run multiple excel files off of one macro. | Excel Worksheet Functions | |||
Macro for multiple open files | Excel Discussion (Misc queries) |