I've spent all day trying to make this code work, and I have gotten dozens of errors, some of which I can fix, and some I can't.
Option Explicit
Sub OpenFiles()
Dim MyFolder As String
Dim MyFile As String
Dim wbold As Object
Dim wbnew As Object
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.Calculation = xlCalculationManual
MyFolder = "C:\Users\ALRH\Desktop\Batches"
MyFile = Dir(MyFolder & "\*.xl*")
Set wbold = ThisWorkbook
Do While MyFile <> ""
Workbooks.Open Filename:=MyFolder & "\" & MyFile
Set wbnew = ThisWorkbook
Sheets(1).Select
Range("H25:H90").Copy
Workbooks(wbold).Sheets("Shore Tank Report").Range("I25:I90").PasteSpecial xlPasteValues
Workbooks(wbnew).Range("C7:H7").Copy
Workbooks(wbold).Cells("D7:I7").PasteSpecial xlPasteValues
Workbooks(wbnew).Close SaveChanges:=False
On Error GoTo 0
MyFile = Dir
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub
Right now I'm getting a "Type Mismatch" on the row:
"Workbooks(wbold).Sheets("Shore Tank Report").Range("I25:I90").PasteSpecial xlPasteValues"
Ask if you need more information, and thanks for any help.
Bookmarks