Need to combine first and last name from two columns

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

This is what I have. I need some help as indicated in the comments:

Sub Combine()

Do ' Outer loop.

ActiveCell.Select
last = ActiveCell.Formula

'need to move one cell to the right here

ActiveCell.Select
first = ActiveCell.Formula

'need to move one cell to the right here

ActiveCell.FormulaR1C1 = last + ", " + first

' need to move back to column one here

' need to move down one row here

Loop Until EOF 'Will this stop at the first empty value in column one?

End Sub


Thank you in advance.
 
Dave,

Sub testit()
Dim i As Long, lngLastRow As Long

With Sheet1
lngLastRow = .Cells(1, 1).End(xlDown).Row
For i = 1 To lngLastRow
.Cells(i, 3) = .Cells(i, 1) & ", " & .Cells(i, 2)
Next
End With
End Sub


Rob
 
Rob,

Nice, worked great.

Thanks again,
Dave


Rob van Gelder said:
Dave,

Sub testit()
Dim i As Long, lngLastRow As Long

With Sheet1
lngLastRow = .Cells(1, 1).End(xlDown).Row
For i = 1 To lngLastRow
.Cells(i, 3) = .Cells(i, 1) & ", " & .Cells(i, 2)
Next
End With
End Sub


Rob
 
Back
Top