Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'm stuck and I need VBA help...

Status
Not open for further replies.

DrMingle

Technical User
May 24, 2009
116
US
I have no doubt this is basic, but I'm stuck...

Below is a recorded macro...the file "Tajuana Harper FL62.xls" is one of many Excel files I have to convert to a new file. The format's of the files are the same, but the naming convention is all over the place. In addition, the Worksheets within the files are named differently.

I simply want to replace "Tajuana Harper FL62.xls" with whatever active workbook and worksheet I choose...

My data instead gets thrown all over the place...

Below is the actual recorded macro without any enhancements...


Sub Macro9()
'
' Macro9 Macro
' Macro recorded 5/24/2009 by drmingle
'

'
Windows("Tajuana Harper FL62 Audit.xls").Activate
Range("C5:L5").Select
Selection.Copy
Windows("Team DuBose Audits.xls").Activate
Range("E824").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Windows("Tajuana Harper FL62 Audit.xls").Activate
ActiveWindow.SmallScroll Down:=18
Range("C44:L44").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Team DuBose Audits.xls").Activate
Range("B824").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Windows("Tajuana Harper FL62 Audit.xls").Activate
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Team DuBose Audits.xls").Activate
Range("A824").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("A824:A832"), Type:=xlFillDefault
Range("A824:A832").Select
Windows("Tajuana Harper FL62 Audit.xls").Activate
Range("E2").Select
Selection.Copy
Windows("Team DuBose Audits.xls").Activate
Range("F824").Select
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("F824:F832"), Type:=xlFillDefault
Range("F824:F832").Select
Windows("Tajuana Harper FL62 Audit.xls").Activate
Range("B4").Select
Selection.Copy
Windows("Team DuBose Audits.xls").Activate
Range("D824").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("D824:D832"), Type:=xlFillDefault
Range("D824:D832").Select
Range("C823").Select
Selection.AutoFill Destination:=Range("C823:C832"), Type:=xlFillDefault
Range("C823:C832").Select
End Sub
 
Thanks everybody...I made a few tweaks I my end...but you all figured it out.

Thanks...

Gavona
CTKC
Skip

As you all are well aware I couldn't have gotten this resolved without you...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top