I am looking to add the lines of code in read to the rest of the code below. The code in yellow goes to the end of the data set in a template and counts up to delete hour 2 for each 24 hour set. The code not in red is the original code that sets up the template file. I hope this helps.
Open desired file to format the data
' Delete row for hour 2 for DST 23 hour
ChDrive "L:\OtherImports\Supplier_Loads"
ChDir "L:\OtherImports\Supplier_Loads"
Do
fName = Application.GetOpenFilename
Loop Until fName <> False
Workbooks.Open Filename:=fName
Dim lRow As Long
lRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row - 22
For x = lRow To 2 Step -26
With Rows(x)
.Delete
End With
Next x
ActiveSheet.Range("A1").Select
ActiveWorkbook.SaveAs Filename:="L:\OtherImports\Supplier_Loads\Suppld" & DataDate & ".csv" _
, FileFormat:=xlCSVMSDOS, CreateBackup:=False
Workbooks("Suppld" & DataDate & ".CSV").Close saveChanges:=True
End Function
Example of template setup file before the deletion of hour 2
[TABLE="class: cms_table_MsoNormalTable, width: 192"]
<tbody>[TR]
[TD="width: 64"]
Meter[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
Daily[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
***[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
LOAD[/TD]
[TD="width: 64"]
[/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
***[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
LOAD[/TD]
[TD="width: 64"]
[/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD="width: 64"]
[/TD]
[TD="width: 64"]
[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
</tbody>[/TABLE]