This is my initial excel sheet:
The output I wish, which is a concatenation of column A and Column B as you can see in column F:
Note: I'll add the header "My_Items" manually.
Code:
Sub Test()
Dim lngLastRow As Long
' Selecting all rows
lngLastRow = Cells(Rows.Count, "A").End(xlUp).row
'To concatenate both columns and insert the values into a new column
Range("G2").Formula = "=A2 & "": "" & B2"
Range("G2").Copy Range("G3:G" & lngLastRow)
End Sub
Output after executing the code:
I tried to skip the empty rows using
If Range("A" & ActiveCell.row) <> ""
but it didn't work.