Option Explicit Private Sub Build_All_Charts() Dim StartLine As Long Dim FinishLine As Long On Error GoTo ErrorHandler_01 ' Enable error-handling routine StartLine: StartLine = InputBox("Input Start Line") If StartLine < 4 Then MsgBox "Start Line must be 4 or greater" GoTo StartLine End If FinishLine: FinishLine = InputBox("Input Finish Line") If FinishLine <= StartLine Then MsgBox "Finish Line must be greater than Start Line" GoTo FinishLine End If If FinishLine > Sheets(Sheets(Sheets.Count).Name).Range("A2") Then MsgBox "Finish Line must be less than or equal to the last line of data" GoTo FinishLine End If Hide_Speed_Data StartLine, FinishLine Hide_VANOS_Data StartLine, FinishLine Hide_Temperatures_Data StartLine, FinishLine Hide_Air_Flow_Data StartLine, FinishLine Hide_Shut_Off_Cyl_Data StartLine, FinishLine Hide_Ignition_Data StartLine, FinishLine Exit Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ErrorHandler_01: Select Case Err.Number Case 13 ' "Incorrect format" error. MsgBox "Input data must be a NUMBER" Resume Case Else ' Handle other situations here.... End Select Resume ' Resume execution at same line that caused the error. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' End Sub Private Sub Hide_Speed_Data(FirstLine As Long, LastLine As Long) Hide_Data "Speed Data", "Speed Graph", FirstLine, LastLine End Sub Private Sub Hide_VANOS_Data(FirstLine As Long, LastLine As Long) Hide_Data "VANOS Data", "Exhaust VANOS Chart", FirstLine, LastLine Hide_Data "VANOS Data", "Inlet VANOS Chart", FirstLine, LastLine End Sub Private Sub Hide_Temperatures_Data(FirstLine As Long, LastLine As Long) Hide_Data "Temperatures Data", "Temperatures Chart", FirstLine, LastLine End Sub Private Sub Hide_Air_Flow_Data(FirstLine As Long, LastLine As Long) Hide_Data "Air Flow Data", "Air Flow Chart", FirstLine, LastLine End Sub Private Sub Hide_Shut_Off_Cyl_Data(FirstLine As Long, LastLine As Long) Hide_Data "Shut-Off Cyl Data", "Shut-Off Cyl Chart", FirstLine, LastLine End Sub Private Sub Hide_Ignition_Data(FirstLine As Long, LastLine As Long) Hide_Data "Ignition Data", "Ignition Angle Chart", FirstLine, LastLine Hide_Data "Ignition Data", "Injection Time Chart", FirstLine, LastLine End Sub Private Sub Hide_Data(DataSheetName As String, GraphName As String, StartRow As Long, FinishRow As Long) ' ' Macro1 Macro ' Dim StartRow_Main As Long Dim FinishRow_Main As Long ' Unhide ALL rows Sheets(Sheets(Sheets.Count).Name).Select StartRow_Main = Range("A1").Value FinishRow_Main = Range("A2").Value Sheets(DataSheetName).Select If StartRow_Main = 0 Then MsgBox "Run the macro 'Prepare Data' and try again." Exit Sub End If Rows(StartRow_Main & ":" & FinishRow_Main).EntireRow.Hidden = False ' Hide rows above selection Sheets(DataSheetName).Select If StartRow = 0 Then StartRow = Range("C1").Value If StartRow < 4 Then MsgBox "Start Row must be 4 or greater" Exit Sub ElseIf StartRow = 4 Then ' Do nothing Else Rows("4:" & (StartRow - 1)).EntireRow.Hidden = True End If ' Hide rows below selection Sheets(DataSheetName).Select If FinishRow = 0 Then FinishRow = Range("C2").Value If FinishRow <= StartRow Then MsgBox "Finish Row must be greater than Start Row" Exit Sub Else Rows(FinishRow & ":" & FinishRow_Main).EntireRow.Hidden = True End If ' Select the graph Sheets(GraphName).Select End Sub