RP1America
Technical User
This code...
...is throwing an error at this line...
What I can't figure out is why that doesn't work, when this does...
Thoughts?
Code:
Sub NewSheet()
Application.ScreenUpdating = False
Dim strNewSheetName As String
Last = Cells(Rows.Count, "A").End(xlUp).Row
For i = Last To 1 Step -1
strNewSheetName = Cells(i, "D").Value & " " & Cells(i, "C").Value
Workbooks("Web Transfer Worksheet.xlt").Activate
Sheets("Template").Visible = True
Sheets("Template").Copy after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = strNewSheetName
Dim strMonth As String
Dim strYear As String
Dim strDate As String
strDay = Format$(Day(Now), "00")
strMonth = Format$(Month(Now), "00")
strYear = Format$(Year(Now), "####")
strDate = strYear + strMonth + strDay
Workbooks(strDate + "*_OmniTransferErrorReport.csv").Activate
Next i
Sheets("Template").Visible = False
Application.ScreenUpdating = True
End Sub
...is throwing an error at this line...
Code:
Workbooks(strDate + "*_OmniTransferErrorReport.csv").Activate
What I can't figure out is why that doesn't work, when this does...
Code:
Sub OpenFile()
Dim strMonth As String
Dim strYear As String
Dim strDate As String
strDay = Format$(Day(Now), "00")
strMonth = Format$(Month(Now), "00")
strYear = Format$(Year(Now), "####")
strDate = strYear + strMonth + strDay
Workbooks.Open _
("I:\Ryan Plew\Web Transfer VBA\" + strDate + "*_OmniTransferErrorReport.csv")
End Sub
Thoughts?