Hi
I have written VBA code (Below). Which opens 3 other wb. Copies to selcted ws then creates a set of complete data with comprehensive information. This data will ultimately be used to print out documents in Crystal.
The wb opened are from variable paths. ie. O:\Transport\RSHEETS\Run Sheets nn\ nn nn\ nnnn nn nn nn.xls. Is one wb.
However where I have added a breakpoint, I cannot activate this wb even though I have used a Dim statement to refer to the wb. The first error occurs where I have highlighted red text, returning a message of 'Runtime error '9' subscript out of range.'
Can you help please?
Sub InsertCSVData()
'Get Run key and Delivery Date Information
Runk = InputBox("Enter Current Run Key (4 characters): ", "Input Run Key")
RSDate = InputBox("Enter Date ie dd mm yy (8 characters): ", "Input Date")
Dim rsheetfilename As String
Dim rsheetwindowname As String
'Open CSV Files Calls = Panasonic Run Sheet - Calls Written by Tina Slesser on 14/10/08
Workbooks.Open Filename:="O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - calls " + Runk + ".csv"
'CallsFilename = "O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - calls " + Runk + ".csv"
Workbooks.Open Filename:="O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - trips " + Runk + ".csv"
'TripsFilename = "O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - trips " + Runk + ".csv"
Workbooks.Open Filename:="O:\Transport\RSHEETS\RUN SHEET " + Mid(RSDate, 7, 2) + "\" + Mid(RSDate, 4, 2) + " " + Mid(RSDate, 7, 2) + "\" + Runk + " " + RSDate + ".xls "
rsheetfilename = "O:\Transport\RSHEETS\RUN SHEET " + Mid(RSDate, 7, 2) + "\" + Mid(RSDate, 4, 2) + " " + Mid(RSDate, 7, 2) + "\" + Runk + " " + RSDate + ".xls "
rsheetwindowname = Runk + " " + RSDate + ".xls "
'Open RSheetFilename For Random As #1
'Open CallsFilename For Random As #2
'Open TripsFilename For Random As #3
' Written on 14/10/2008 by Tina Slesser Ensures starting point for data import
Windows("Runsheet Print Master.xls").Activate
Sheets("Day Sheet Data").Select
Range("a1").Select
' InsertCSVData Macro
' Written on 14/10/2008 by Tina Slesser Copies all data from CSV files and Routesheet to Printing File
'
Range("A1").Select
'Windows("2390 23 09 08.xls").Activate
Windows("rsheetwindowname").Activate
'RSheetFilename = "O:\Transport\RSHEETS\RUN SHEET " + Mid(RSDate, 7, 2) + "\" + Mid(RSDate, 4, 2) + " " + Mid(RSDate, 7, 2) + "\" + Runk + " " + RSDate + ".xls "
Cells.Select
Range("B1").Activate
Selection.Copy
Windows("Runsheet Print Master.xls").Activate
ActiveWindow.WindowState = xlNormal
Cells.Select
ActiveSheet.Paste
ActiveWindow.Zoom = 25
Selection.Interior.ColorIndex = xlNone
Selection.Font.ColorIndex = 0
Range("C4").Select
Sheets("CallsCSV").Select
Windows("Panasonic Run Sheet - Calls 2390.CSV").Activate
'"O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - calls " + Runk + ".csv"
Cells.Select
Selection.Copy
Windows("Runsheet Print Master.xls").Activate
ActiveWindow.WindowState = xlNormal
Range("A1").Select
ActiveSheet.Paste
Sheets("TripsCSV").Select
Windows("Panasonic Run Sheet - trips 2390.CSV").Activate
'"O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - trips " + Runk + ".csv"
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Windows("Runsheet Print Master.xls").Activate
ActiveWindow.WindowState = xlNormal
Range("A1").Select
ActiveSheet.Paste
Range("C13").Select
Sheets("Complete Data").Select
Range("A2").Select
Application.CutCopyMode = False
ActiveWorkbook.Save
'SetupCompleteData Macro
' Written on 14/10/2008 by Tina Slesser. Set up Complete data for printing
'
'
Sheets("Day Sheet Data").Select
Range("B1").Select
Selection.Copy
Sheets("Complete Data").Select
ActiveSheet.Paste
Application.CutCopyMode = False
With Selection.Font
.Name = "Arial"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleSingle
.ColorIndex = xlAutomatic
End With
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleSingle
.ColorIndex = xlAutomatic
End With
Selection.Font.Bold = False
Selection.Font.Underline = xlUnderlineStyleNone
With Selection.Font
.Name = "Arial"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("F2").Select
ActiveCell.FormulaR1C1 = ""
Cells.Select
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Font
.Name = "Arial"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("F2").Select
ActiveCell.FormulaR1C1 = "=+CallsCSV!R[-1]C[-3]"
Range("G2").Select
ActiveCell.FormulaR1C1 = "+CallsCSV!g1"
Cells.Select
Selection.Font.Bold = True
Selection.Font.Bold = False
Selection.Font.Underline = xlUnderlineStyleSingle
Selection.Font.Underline = xlUnderlineStyleNone
Selection.NumberFormat = "General"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=CallsCSV!R[-1]C[-3]"
Range("H2").Select
ActiveCell.FormulaR1C1 = "=CallsCSV!R[-1]C[-2]"
Range("I2").Select
ActiveCell.FormulaR1C1 = "=CallsCSV!R[-1]C[-7]"
Range("J2").Select
ActiveCell.FormulaR1C1 = "=CallsCSV!R[-1]C[-1]"
Range("K2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],19,FALSE)"
Selection.AutoFill Destination:=Range("K2:M2"), Type:=xlFillDefault
Range("K2:M2").Select
Range("L2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],20,FALSE)"
Range("M2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],16,FALSE)"
Range("K2").Select
Selection.Copy
Range("B2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],5,FALSE)"
Range("B2").Select
Selection.AutoFill Destination:=Range("B2:E2"), Type:=xlFillDefault
Range("B2:E2").Select
Range("C2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],7,FALSE)"
Range("D2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],6,FALSE)"
Range("E2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],3,FALSE)"
Range("B2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],6,FALSE)"
Range("C2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],8,FALSE)"
Range("D2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],7,FALSE)"
Range("E2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],4,FALSE)"
Range("B2").Select
Sheets("Complete Data").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],5,FALSE)"
Range("C2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],7,FALSE)"
Range("D2").Select
Sheets("Complete Data").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],6,FALSE)"
Range("A2").Select
ActiveCell.FormulaR1C1 = "=+'Day Sheet Data'!R[-1]C[1]"
Range("A2").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Cells.Select
Cells.EntireColumn.AutoFit
Range("B2").Select
Selection.AutoFill Destination:=Range("B2:B3"), Type:=xlFillDefault
Range("B2:B3").Select
Range("B2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,5,FALSE)"
Range("B2").Select
Selection.AutoFill Destination:=Range("B2:B3"), Type:=xlFillDefault
Range("B2:B3").Select
Range("B3").Select
Sheets("Day Sheet Data").Select
Columns("A:A").ColumnWidth = 26.14
Sheets("Complete Data").Select
Selection.AutoFill Destination:=Range("B3:B1577"), Type:=xlFillDefault
Range("B3:B1577").Select
ActiveWindow.LargeScroll Down:=-50
Range("C2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,7,FALSE)"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,6,FALSE)"
Range("E2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,4,FALSE)"
Range("K2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,19,FALSE)"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,20,FALSE)"
Range("M2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,16,FALSE)"
Range("A2").Select
ActiveCell.FormulaR1C1 = "=+'Day Sheet Data'!R[-1]C2"
Range("A2").Select
Selection.AutoFill Destination:=Range("A2:A3"), Type:=xlFillDefault
Range("A2:A3").Select
Range("A2").Select
ActiveCell.FormulaR1C1 = "=+'Day Sheet Data'!R1C2"
Range("A2").Select
Selection.AutoFill Destination:=Range("A2:A3"), Type:=xlFillDefault
Range("A2:A3").Select
Selection.AutoFill Destination:=Range("A2:A1870"), Type:=xlFillDefault
Range("A2:A1870").Select
ActiveWindow.LargeScroll Down:=-7
ActiveWindow.ScrollRow = 1
Range("F2:G2").Select
Selection.AutoFill Destination:=Range("F2:G1870"), Type:=xlFillDefault
Range("F2:G1870").Select
ActiveWindow.ScrollRow = 1
Range("H2:J2").Select
Selection.AutoFill Destination:=Range("H2:J1870"), Type:=xlFillDefault
Range("H2:J1870").Select
ActiveWindow.LargeScroll Down:=-13
ActiveWindow.ScrollRow = 1
Range("E2").Select
Selection.AutoFill Destination:=Range("E2:E3"), Type:=xlFillDefault
Range("E2:E3").Select
Selection.AutoFill Destination:=Range("E2:E6"), Type:=xlFillDefault
Range("E2:E6").Select
Selection.AutoFill Destination:=Range("E2:E1870"), Type:=xlFillDefault
Range("E2:E1870").Select
ActiveWindow.ScrollRow = 1
Range("C2:D2").Select
Selection.AutoFill Destination:=Range("C2:D1870"), Type:=xlFillDefault
Range("C2:D1870").Select
ActiveWindow.LargeScroll Down:=-10
ActiveWindow.SmallScroll Down:=21
Range("B1576").Select
Selection.AutoFill Destination:=Range("B1576:B1870"), Type:=xlFillDefault
Range("B1576:B1870").Select
ActiveWindow.LargeScroll Down:=-4
ActiveWindow.ScrollRow = 1
Range("K2:M2").Select
Selection.AutoFill Destination:=Range("K2:M1870"), Type:=xlFillDefault
Range("K2:M1870").Select
Range("H1860").Select
Range("K1851").Select
ActiveWindow.ScrollRow = 1
Range("D1840").Select
Cells.Select
Range("A2").Activate
Cells.EntireColumn.AutoFit
ActiveWindow.LargeScroll ToRight:=1
Range("M22").Select
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.SmallScroll Down:=60
ActiveWorkbook.Save
' Written on 14/10/2008 by Tina Slesser Close files after copying data to Printing Runsheet File
'
'RSheetFilename = "O:\Transport\RSHEETS\RUN SHEET " + Mid(RSDate, 7, 2) + "\" + Mid(RSDate, 4, 2) + " " + Mid(RSDate, 7, 2) + "\" + Runk + " " + RSDate + ".xls ".Activate
Windows("2390 23 09 08.xls").Activate
ActiveWindow.Close
'Windows("O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - trips " + Runk + ".csv").Activate
Windows("Panasonic Run Sheet - trips 2390.CSV").Activate
ActiveWindow.Close
'Windows("O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - calls " + Runk + ".csv").Activate
Windows("Panasonic Run Sheet - calls 2390.CSV").Activate
ActiveWindow.Close
End Sub
I have written VBA code (Below). Which opens 3 other wb. Copies to selcted ws then creates a set of complete data with comprehensive information. This data will ultimately be used to print out documents in Crystal.
The wb opened are from variable paths. ie. O:\Transport\RSHEETS\Run Sheets nn\ nn nn\ nnnn nn nn nn.xls. Is one wb.
However where I have added a breakpoint, I cannot activate this wb even though I have used a Dim statement to refer to the wb. The first error occurs where I have highlighted red text, returning a message of 'Runtime error '9' subscript out of range.'
Can you help please?
Sub InsertCSVData()
'Get Run key and Delivery Date Information
Runk = InputBox("Enter Current Run Key (4 characters): ", "Input Run Key")
RSDate = InputBox("Enter Date ie dd mm yy (8 characters): ", "Input Date")
Dim rsheetfilename As String
Dim rsheetwindowname As String
'Open CSV Files Calls = Panasonic Run Sheet - Calls Written by Tina Slesser on 14/10/08
Workbooks.Open Filename:="O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - calls " + Runk + ".csv"
'CallsFilename = "O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - calls " + Runk + ".csv"
Workbooks.Open Filename:="O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - trips " + Runk + ".csv"
'TripsFilename = "O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - trips " + Runk + ".csv"
Workbooks.Open Filename:="O:\Transport\RSHEETS\RUN SHEET " + Mid(RSDate, 7, 2) + "\" + Mid(RSDate, 4, 2) + " " + Mid(RSDate, 7, 2) + "\" + Runk + " " + RSDate + ".xls "
rsheetfilename = "O:\Transport\RSHEETS\RUN SHEET " + Mid(RSDate, 7, 2) + "\" + Mid(RSDate, 4, 2) + " " + Mid(RSDate, 7, 2) + "\" + Runk + " " + RSDate + ".xls "
rsheetwindowname = Runk + " " + RSDate + ".xls "
'Open RSheetFilename For Random As #1
'Open CallsFilename For Random As #2
'Open TripsFilename For Random As #3
' Written on 14/10/2008 by Tina Slesser Ensures starting point for data import
Windows("Runsheet Print Master.xls").Activate
Sheets("Day Sheet Data").Select
Range("a1").Select
' InsertCSVData Macro
' Written on 14/10/2008 by Tina Slesser Copies all data from CSV files and Routesheet to Printing File
'
Range("A1").Select
'Windows("2390 23 09 08.xls").Activate
Windows("rsheetwindowname").Activate
'RSheetFilename = "O:\Transport\RSHEETS\RUN SHEET " + Mid(RSDate, 7, 2) + "\" + Mid(RSDate, 4, 2) + " " + Mid(RSDate, 7, 2) + "\" + Runk + " " + RSDate + ".xls "
Cells.Select
Range("B1").Activate
Selection.Copy
Windows("Runsheet Print Master.xls").Activate
ActiveWindow.WindowState = xlNormal
Cells.Select
ActiveSheet.Paste
ActiveWindow.Zoom = 25
Selection.Interior.ColorIndex = xlNone
Selection.Font.ColorIndex = 0
Range("C4").Select
Sheets("CallsCSV").Select
Windows("Panasonic Run Sheet - Calls 2390.CSV").Activate
'"O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - calls " + Runk + ".csv"
Cells.Select
Selection.Copy
Windows("Runsheet Print Master.xls").Activate
ActiveWindow.WindowState = xlNormal
Range("A1").Select
ActiveSheet.Paste
Sheets("TripsCSV").Select
Windows("Panasonic Run Sheet - trips 2390.CSV").Activate
'"O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - trips " + Runk + ".csv"
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Windows("Runsheet Print Master.xls").Activate
ActiveWindow.WindowState = xlNormal
Range("A1").Select
ActiveSheet.Paste
Range("C13").Select
Sheets("Complete Data").Select
Range("A2").Select
Application.CutCopyMode = False
ActiveWorkbook.Save
'SetupCompleteData Macro
' Written on 14/10/2008 by Tina Slesser. Set up Complete data for printing
'
'
Sheets("Day Sheet Data").Select
Range("B1").Select
Selection.Copy
Sheets("Complete Data").Select
ActiveSheet.Paste
Application.CutCopyMode = False
With Selection.Font
.Name = "Arial"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleSingle
.ColorIndex = xlAutomatic
End With
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleSingle
.ColorIndex = xlAutomatic
End With
Selection.Font.Bold = False
Selection.Font.Underline = xlUnderlineStyleNone
With Selection.Font
.Name = "Arial"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("F2").Select
ActiveCell.FormulaR1C1 = ""
Cells.Select
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Font
.Name = "Arial"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("F2").Select
ActiveCell.FormulaR1C1 = "=+CallsCSV!R[-1]C[-3]"
Range("G2").Select
ActiveCell.FormulaR1C1 = "+CallsCSV!g1"
Cells.Select
Selection.Font.Bold = True
Selection.Font.Bold = False
Selection.Font.Underline = xlUnderlineStyleSingle
Selection.Font.Underline = xlUnderlineStyleNone
Selection.NumberFormat = "General"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=CallsCSV!R[-1]C[-3]"
Range("H2").Select
ActiveCell.FormulaR1C1 = "=CallsCSV!R[-1]C[-2]"
Range("I2").Select
ActiveCell.FormulaR1C1 = "=CallsCSV!R[-1]C[-7]"
Range("J2").Select
ActiveCell.FormulaR1C1 = "=CallsCSV!R[-1]C[-1]"
Range("K2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],19,FALSE)"
Selection.AutoFill Destination:=Range("K2:M2"), Type:=xlFillDefault
Range("K2:M2").Select
Range("L2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],20,FALSE)"
Range("M2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],16,FALSE)"
Range("K2").Select
Selection.Copy
Range("B2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],5,FALSE)"
Range("B2").Select
Selection.AutoFill Destination:=Range("B2:E2"), Type:=xlFillDefault
Range("B2:E2").Select
Range("C2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],7,FALSE)"
Range("D2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],6,FALSE)"
Range("E2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],3,FALSE)"
Range("B2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],6,FALSE)"
Range("C2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],8,FALSE)"
Range("D2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],7,FALSE)"
Range("E2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],4,FALSE)"
Range("B2").Select
Sheets("Complete Data").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],5,FALSE)"
Range("C2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],7,FALSE)"
Range("D2").Select
Sheets("Complete Data").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC6,'Day Sheet Data'!R[-1]:R[65534],6,FALSE)"
Range("A2").Select
ActiveCell.FormulaR1C1 = "=+'Day Sheet Data'!R[-1]C[1]"
Range("A2").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Cells.Select
Cells.EntireColumn.AutoFit
Range("B2").Select
Selection.AutoFill Destination:=Range("B2:B3"), Type:=xlFillDefault
Range("B2:B3").Select
Range("B2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,5,FALSE)"
Range("B2").Select
Selection.AutoFill Destination:=Range("B2:B3"), Type:=xlFillDefault
Range("B2:B3").Select
Range("B3").Select
Sheets("Day Sheet Data").Select
Columns("A:A").ColumnWidth = 26.14
Sheets("Complete Data").Select
Selection.AutoFill Destination:=Range("B3:B1577"), Type:=xlFillDefault
Range("B3:B1577").Select
ActiveWindow.LargeScroll Down:=-50
Range("C2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,7,FALSE)"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,6,FALSE)"
Range("E2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,4,FALSE)"
Range("K2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,19,FALSE)"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,20,FALSE)"
Range("M2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC6,'Day Sheet Data'!R1:R65536,16,FALSE)"
Range("A2").Select
ActiveCell.FormulaR1C1 = "=+'Day Sheet Data'!R[-1]C2"
Range("A2").Select
Selection.AutoFill Destination:=Range("A2:A3"), Type:=xlFillDefault
Range("A2:A3").Select
Range("A2").Select
ActiveCell.FormulaR1C1 = "=+'Day Sheet Data'!R1C2"
Range("A2").Select
Selection.AutoFill Destination:=Range("A2:A3"), Type:=xlFillDefault
Range("A2:A3").Select
Selection.AutoFill Destination:=Range("A2:A1870"), Type:=xlFillDefault
Range("A2:A1870").Select
ActiveWindow.LargeScroll Down:=-7
ActiveWindow.ScrollRow = 1
Range("F2:G2").Select
Selection.AutoFill Destination:=Range("F2:G1870"), Type:=xlFillDefault
Range("F2:G1870").Select
ActiveWindow.ScrollRow = 1
Range("H2:J2").Select
Selection.AutoFill Destination:=Range("H2:J1870"), Type:=xlFillDefault
Range("H2:J1870").Select
ActiveWindow.LargeScroll Down:=-13
ActiveWindow.ScrollRow = 1
Range("E2").Select
Selection.AutoFill Destination:=Range("E2:E3"), Type:=xlFillDefault
Range("E2:E3").Select
Selection.AutoFill Destination:=Range("E2:E6"), Type:=xlFillDefault
Range("E2:E6").Select
Selection.AutoFill Destination:=Range("E2:E1870"), Type:=xlFillDefault
Range("E2:E1870").Select
ActiveWindow.ScrollRow = 1
Range("C2:D2").Select
Selection.AutoFill Destination:=Range("C2:D1870"), Type:=xlFillDefault
Range("C2:D1870").Select
ActiveWindow.LargeScroll Down:=-10
ActiveWindow.SmallScroll Down:=21
Range("B1576").Select
Selection.AutoFill Destination:=Range("B1576:B1870"), Type:=xlFillDefault
Range("B1576:B1870").Select
ActiveWindow.LargeScroll Down:=-4
ActiveWindow.ScrollRow = 1
Range("K2:M2").Select
Selection.AutoFill Destination:=Range("K2:M1870"), Type:=xlFillDefault
Range("K2:M1870").Select
Range("H1860").Select
Range("K1851").Select
ActiveWindow.ScrollRow = 1
Range("D1840").Select
Cells.Select
Range("A2").Activate
Cells.EntireColumn.AutoFit
ActiveWindow.LargeScroll ToRight:=1
Range("M22").Select
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.SmallScroll Down:=60
ActiveWorkbook.Save
' Written on 14/10/2008 by Tina Slesser Close files after copying data to Printing Runsheet File
'
'RSheetFilename = "O:\Transport\RSHEETS\RUN SHEET " + Mid(RSDate, 7, 2) + "\" + Mid(RSDate, 4, 2) + " " + Mid(RSDate, 7, 2) + "\" + Runk + " " + RSDate + ".xls ".Activate
Windows("2390 23 09 08.xls").Activate
ActiveWindow.Close
'Windows("O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - trips " + Runk + ".csv").Activate
Windows("Panasonic Run Sheet - trips 2390.CSV").Activate
ActiveWindow.Close
'Windows("O:\Transport\RSHEETS\Run Sheet Printing\CSV Files\panasonic run sheet - calls " + Runk + ".csv").Activate
Windows("Panasonic Run Sheet - calls 2390.CSV").Activate
ActiveWindow.Close
End Sub