Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have created a macro that copies and pastes info from one
spreadsheet to another in the format the I need. What I am attempting to figure out now is how can I run this macro on multiple files. There are about 10 files per day that i need to run this macro on and the file names will change daily. How can i have the macro reference the desktop folder that i will store these files in and run the macro through all files? Is this possible? Secondly, in the macro, the last step is create an XML file out of the spreadsheet the macro created. It always stops at this step, prompting me to name the file. Is there a way to automatically name the file the contents of a specific cell and save it to a destination? I would really appreciate anyones help with this. I'm clearly not very skilled with this, so any help you can offer would be greatly appreciated :) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just change sDir to the name of the folder you want to import from,
not sure about the XML part though (I'm still on xl2k): Sub TryThis() Dim myBook As Workbook, _ ThisSheet As Worksheet, _ sDir, sFile As String sDir = "C:\FolderName\" sFile = "*.xls" Set ThisSheet = ActiveWorkbook.Sheets(1) With Application .DisplayAlerts = False With .FileSearch .NewSearch .LookIn = sDir .Filename = sFile .MatchTextExactly = True If .Execute < 0 Then Exit Sub For i = 1 To .FoundFiles.Count - 1 Set myBook = Workbooks.Open(.FoundFiles(i)) With myBook .Sheets(1).Range("A1").CurrentRegion.Copy ThisSheet.Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial .Close End With Next i End With .DisplayAlerts = True End With Set myBook = Nothing Set ThisSheet = Nothing End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor | Excel Programming | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |