ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I repeat a macro? (https://www.excelbanter.com/excel-programming/359071-how-can-i-repeat-macro.html)

emil

How can I repeat a macro?
 
I have a check list with the name of some hundred documents. I want to open
them by turns, to copy date from these documents and to inscribe them in a
centralizer document. I wrote the macro for one running but I want to repeat
an automaton for all documents. I don't want the prompt messages for each
run. How can I do this?
Thanks for any helps

Emil


Don Guillett

How can I repeat a macro?
 
As ALWAYS, post your coding efforts for comments and suggestions.

--
Don Guillett
SalesAid Software

"emil" wrote in message
...
I have a check list with the name of some hundred documents. I want to open
them by turns, to copy date from these documents and to inscribe them in a
centralizer document. I wrote the macro for one running but I want to
repeat
an automaton for all documents. I don't want the prompt messages for each
run. How can I do this?
Thanks for any helps

Emil




[email protected][_2_]

How can I repeat a macro?
 
You can write two macros (routines) something like this:

Sub Macro1()

Workbooks.Open Filename:="pathname\filename.extension"
Call Macro2()

' Repeat for each filename you want to open
' Alternatively you can write a filesearch routine that looks/opens
files with certain path/filename criteria...

End Sub

Sub Macro2()

Range("CopyRange").Select
Selection.Copy

Windows("CentralizerDocumentName.extension").Activ ate
Sheets("SheetNameifExcel").Select

' May want to use if statement here for pasting in a certain
location
Range("PasteRange").Select
Selection.Paste ' or some variant paste

End Sub

Hope this helps.



All times are GMT +1. The time now is 09:36 AM.

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