Hey all,
I'm relatively new to writing macro's, so be gentle. What I want to do is start in one workbook, open another workbook using the getopenfilename command, copy and paste several cells from the opened workbook into the initial workbook, then close the one that was opened using getopenfilename. My problem is, I want to do this several times, so the code needs to recognize that the filenames are changing. I tried passing the value from getopenfilename into the activate commands, but I clearly am out of my league already. Can anyone help? The code is posted below:
IdatafromIVtrace Macro
' Macro recorded 2/17/2010 by Dave
'
'
FileToOpen = Application _
.GetOpenFilename()
If FileToOpen <> False Then
End If
Workbooks.OpenText Filename:=FileToOpen, _
DataType:=xlDelimited, Tab:=True
Range("D1:E1").Select
Selection.Copy
Windows("Book1").Activate
ActiveSheet.Paste
Windows(FileToOpen).Activate
Range("B11,G11").Select
Range("G11").Activate
Application.CutCopyMode = False
Selection.Copy
Windows("Book1").Activate
Range("C1").Select
ActiveSheet.Paste
Windows("021010 445pm PL1.xls").Activate
Range("P5").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Book1").Activate
Range("E1").Select
ActiveSheet.Paste
Windows("021010 445pm PL1.xls").Activate
ActiveWorkbook.Close
End Sub
Bookmarks