Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Need to combine first and last name from two columns

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Need to combine first and last name from two columns

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

"Dave" wrote in message
...
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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Need to combine first and last name from two columns

Rob,

Nice, worked great.

Thanks again,
Dave


"Rob van Gelder" wrote in message
...
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

"Dave" wrote in message
...
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.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 2 July 31st 06 09:45 PM
Combine columns smash123 Excel Discussion (Misc queries) 3 July 31st 06 07:48 PM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 0 July 31st 06 05:07 PM
combine 2 columns David Excel Worksheet Functions 3 September 26th 05 07:13 PM
How to combine two columns? Robert Judge Excel Worksheet Functions 1 May 23rd 05 06:54 PM


All times are GMT +1. The time now is 08:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"