WE have a code to clean and then copy excel data into a tab, where it accumulates. Columns A:H.
We need this data to have month in the next column (I). For all the new lines, meaning in the range (Ix:Ix) where the length is from last row of column I to last row of the newly pasted data.
The Code is below:
Sub Trial_Fix()
' Trial_Fix Macro
Dim LastRow As Long
' Deleting columns and adding columns of the raw data.
Sheets("FP Data dump").Select
Range("A:I,K:R,V:W").Select
Selection.Delete Shift:=xlToLeft
Columns("C:D").Select
Selection.Insert Shift:=xlToRight
Range("A1").Select
Sheets("CF Data Dump").Select
Range("A:C,E:E,H:H,J:J,M:O,Q:S,G:G").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
Sheets("Fuel Data Dump").Select
Range("A:C,E:G,I:J,N:O,Q:Q,S:AC").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
' Pasting CF Data
' Pasting FP + Data
' Pasting Fuel Data
Sheets("Fuel Data Dump").Select
LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
Range("A1:H" & LastRow).Select
Selection.Copy
Sheets("CLEAN FUEL DATA").Select
Range("A" & Rows.Count).End(xlUp).Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub