I think you need to be more explicit in your description. Are you talking about opening Excel files & copying data into them, opening text files & copying data into them, or copying the files to some other location (folder)?
Quote:Originally Posted by NateBrei I think you need to be more explicit in your description. Are you talking about opening Excel files & copying data into them, opening text files & copying data into them, or copying the files to some other location (folder)?
Nate
I'd like to open all Excel files in a subdirectory because I'll be pasting data into these files from another Excel sheet in a different dir. The paste will occur in sheets named "Data" which is the same in all the destination files. I understand the copy and paste portion, I just don't know how to get the files opened up to cycle thru and copy to them.
Sub Open_My_Files()
Dim MyFile As String
MyPath = "D:\Data\"
MyFile = Dir(MyPath)
Do While MyFile <> ""
If MyFile Like "*.xls" Then Workbooks.Open MyPath & MyFile
Sheets(1).Select
'Paste Code here
ActiveWorkbook.Close True
End If
MyFile = Dir
Loop
End Sub
Sub Open_My_Files()
Dim MyFile As String
MyPath = "D:\Data\"
MyFile = Dir(MyPath)
Do While MyFile <> ""
If MyFile Like "*.xls" Then Workbooks.Open MyPath & MyFile
Sheets(1).Select
'Paste Code here
ActiveWorkbook.Close True
End If
MyFile = Dir
Loop
End Sub
Mike-
How can I get to be as smart as you?? You are the MAN!! Thanks so much. I spent 3 days trying to figure this one out and you got it!! Much appreciation...Sunny :-D