C
Crownman
I am trying to create a macro that will copy the values of several
different ranges from a series of identically formatted workbooks to a
single new file to create a database. So far I have the following
code that does what I need for a single file, but I need to have the
macro recognize each new file rather than being fixed on the first
file (TEST 1). TEST 1 is the active file when I start the macro.
Most of this was done via the macro recorder as my knowledge of VBA is
extremely limited.
Sub FOB_REVIEW()
'
' Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Windows("FOB REVIEW.xls").Activate
Range("A6").End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("TEST-1.xls").Activate
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy
Windows("FOB REVIEW.xls").Activate
Range("A6").End(xlDown).Offset(0, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("TEST-1.xls").Activate
Range("B4").Select
Application.CutCopyMode = False
Selection.Copy
Windows("FOB REVIEW.xls").Activate
Range("A6").End(xlDown).Offset(0, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("TEST-1.xls").Activate
Range("C27").Select
''ActiveWindow.SmallScroll ToRight:=-4
Range("E26:R26").Select
Application.CutCopyMode = False
Selection.Copy
Windows("FOB REVIEW.xls").Activate
Range("A6").End(xlDown).Offset(0, 3).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A7").Select
End Sub
I would appreciate any help anyone can give me on this. TIA
Crownman
different ranges from a series of identically formatted workbooks to a
single new file to create a database. So far I have the following
code that does what I need for a single file, but I need to have the
macro recognize each new file rather than being fixed on the first
file (TEST 1). TEST 1 is the active file when I start the macro.
Most of this was done via the macro recorder as my knowledge of VBA is
extremely limited.
Sub FOB_REVIEW()
'
' Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Windows("FOB REVIEW.xls").Activate
Range("A6").End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("TEST-1.xls").Activate
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy
Windows("FOB REVIEW.xls").Activate
Range("A6").End(xlDown).Offset(0, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("TEST-1.xls").Activate
Range("B4").Select
Application.CutCopyMode = False
Selection.Copy
Windows("FOB REVIEW.xls").Activate
Range("A6").End(xlDown).Offset(0, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("TEST-1.xls").Activate
Range("C27").Select
''ActiveWindow.SmallScroll ToRight:=-4
Range("E26:R26").Select
Application.CutCopyMode = False
Selection.Copy
Windows("FOB REVIEW.xls").Activate
Range("A6").End(xlDown).Offset(0, 3).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A7").Select
End Sub
I would appreciate any help anyone can give me on this. TIA
Crownman