GetDate:
Inputdate = InputBox("Please enter the reporting date in the following format: 070305.", "Date Input")
If Len(Inputdate) = 6 Then
dtEnddate = Left(Inputdate, 2) & "/" & Mid(Inputdate, 3, 2) & "/" & Right(Inputdate, 2)
DateInput1 = dtEnddate
DateInput1 = DateAdd("d", -1, DateInput1)
datelit = Format(DateInput1, "mmddyy")
Workbooks.Open ("\\fileserve\Timetndr\Service Level\Gas South Reports\GS Data Template.xls")
Workbooks.Open ("\\fileserve\Timetndr\Service Level\Gas South Reports\Data Files\Daily\gs." & datelit & ".xls")
Windows("gs." + datelit + ".xls").Activate
GoTo GetData
Else
End If
MsgBox "Date must be exactly 6 digits and you entered " & Inputdate
GoTo GetDate
GetData:
If ActiveSheet.Cells(x, "a") = "" Then
GoTo GotFile
Else
End If
x = x + 1
GoTo GetData
GotFile:
x = x - 1
Worksheets("Gas South Script").Range(Cells(2, "a"), Cells(x, "o")).Copy
Windows("GS Data Template.xls").Activate
If sw1 = 0 Then
m = x
sw1 = 1
Else
m = m + x - 1
End If
ActiveSheet.Paste Destination:=Worksheets("Gas South Script").Range(Cells(n, "a"), Cells(m, "o"))
Application.CutCopyMode = False
Windows("gs." + datelit + ".xls").Activate
ActiveSheet.Cells(x + 1, "a").Select
Workbooks("gs." + datelit + ".xls").Close
Windows("GS Data Template.xls").Activate
x = 2
n = m + 1
Bkup = Bkup + 1
If Bkup = 6 Then
x = 2
Fname = ("\\fileserve\Timetndr\Service Level\Gas South Reports\Data Files\Weekly\gs." + Inputdate + ".xls")
ActiveWorkbook.SaveAs Filename:=Fname
Workbooks("gs." + Inputdate + ".xls").Close
GoTo OpenFiles
Else
End If
DateInput1 = DateAdd("d", -1, DateInput1)
datelit = Format(DateInput1, "mmddyy")
Workbooks.Open ("\\fileserve\Timetndr\Service Level\Gas South Reports\Data Files\Daily\gs." & datelit & ".xls")
Windows("gs." + datelit + ".xls").Activate
GoTo GetData