Columns("Q:Q").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Dim lastRow As Long
lastRow = Range("O3" & Rows.Count).End(xlUp).Row
Range("P4:P" & lastRow).Select
Selection.Copy
Range("Q4").Select
ActiveSheet.Paste
I am trying to insert a column next to Q column, copy the data from P column based on the length of the adjacent column ("O") and paste the data into the inserted column.
Above is the code I am using to achieve this. But the problem is column P and O don't have the same length of data every time.
I am not sure what I am missing here. Someone correct me where I am doing it wrong.
Thanks in Advance!