M
mbos015
i have code to open multiple xls files shown below. as each file opens i
want to copy columns from the newly opened workbook and paste them in
the same place in the master. I have shown a sort of macro code shown
under the #'s below but i don't know how to reference the workbooks and
paste the columns in without using the actual file names...
could someone fill in the blanks for me...
Dim fn As Variant, f As Integer
fn = Application.GetOpenFilename("Excel-files,*.xls", _
1, "Select One Or More Files To Open", , True)
If TypeName(fn) = "Boolean" Then Exit Sub
For f = 1 To UBound(fn)
Debug.Print "Selected file #" & f & ": " & fn(f)
Workbooks.Open fn(f)
MsgBox ActiveWorkbook.Name, , "Active Workbook Name:"
Next f
########################################
'Windows("JUST OPENED WORKBOOK?????:").Activate
' Columns("I:IV").Select
' Range("I2").Activate
' Selection.Copy
' Windows("MASTER WORKBOOK?????").Activate
' Columns("I:IV").Select
' Range("I2").Activate
' ActiveSheet.Paste
then close
want to copy columns from the newly opened workbook and paste them in
the same place in the master. I have shown a sort of macro code shown
under the #'s below but i don't know how to reference the workbooks and
paste the columns in without using the actual file names...
could someone fill in the blanks for me...
Dim fn As Variant, f As Integer
fn = Application.GetOpenFilename("Excel-files,*.xls", _
1, "Select One Or More Files To Open", , True)
If TypeName(fn) = "Boolean" Then Exit Sub
For f = 1 To UBound(fn)
Debug.Print "Selected file #" & f & ": " & fn(f)
Workbooks.Open fn(f)
MsgBox ActiveWorkbook.Name, , "Active Workbook Name:"
Next f
########################################
'Windows("JUST OPENED WORKBOOK?????:").Activate
' Columns("I:IV").Select
' Range("I2").Activate
' Selection.Copy
' Windows("MASTER WORKBOOK?????").Activate
' Columns("I:IV").Select
' Range("I2").Activate
' ActiveSheet.Paste
then close