Option Explicit Sub z_DeleteData() Dim RawDataSheetName As String RawDataSheetName = Sheets(Sheets.Count).Name ' Ignition Data Delete_Graph_Data "Ignition Data", RawDataSheetName ' Shut-Off Cyl Data Delete_Graph_Data "Shut-Off Cyl Data", RawDataSheetName ' Air Flow Data Delete_Graph_Data "Air Flow Data", RawDataSheetName ' Temperatures Data Delete_Graph_Data "Temperatures Data", RawDataSheetName ' VANOS Data Delete_Graph_Data "VANOS Data", RawDataSheetName ' Speed Data Delete_Graph_Data "Speed Data", RawDataSheetName ' Raw Data Sheets(Sheets.Count).Select Rows("5:5").Select Range(Selection, Selection.End(xlDown)).Select Selection.Delete Shift:=xlUp Range("A1:A2").ClearContents Range("A4:AI4").ClearContents Range("C4").Select Sheets(Sheets.Count).Name = "Sheet1" End Sub Private Sub Delete_Graph_Data(GraphDataSheetName As String, MainDataSheetName As String) Dim StartRow As Long Dim FinishRow As Long Dim RawDataSheetName As String RawDataSheetName = Sheets(Sheets.Count).Name StartRow = Sheets(RawDataSheetName).Range("A1").Value FinishRow = Sheets(RawDataSheetName).Range("A2").Value Sheets(GraphDataSheetName).Select Rows(StartRow & ":" & FinishRow).Delete Shift:=xlUp Range("C1").Formula = "='" & MainDataSheetName & "'!A1" Range("C2").Formula = "='" & MainDataSheetName & "'!A2" Range("C1").Select Rows(StartRow & ":" & FinishRow).EntireRow.Hidden = False End Sub