Hi,
I have a data table where I'd like to insert a column B and paste "Channel" in Cell B1 and "Commercial" from cell B2 to last used row in column C. I have below code where it lets me insert a column however returns "Compile error" when running the second code. Appreciate any? Thanks
I have a data table where I'd like to insert a column B and paste "Channel" in Cell B1 and "Commercial" from cell B2 to last used row in column C. I have below code where it lets me insert a column however returns "Compile error" when running the second code. Appreciate any? Thanks
VBA Code:
Sub Addcolumn()
Columns(2).EntireColumn.Insert
Columns(2).ClearFormats
End Sub
Sub Paste()
Dim LastRow As Long
Dim Ws As Worksheet
Set Ws = Worksheets("Sheet1")
LastRow = Ws.Cells(Ws.Rows.Count, 1).End(xlUp).Row
Ws.Range("B2:B" & LastRow).Copy Destination:="Commercial"
Ws.Range("B1").Copy Destination:="Channel"
End Sub
Last edited: