Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I concantenate two columns for the length of a table?
I have a daily report in which I need to combine the 1st and last name. I
would like to write a macro that would concatenate the report, regardless of the number of rows. If the 1st name is in Col A, last name is in Col B, and the combined would go in Col C, what would the VBA text look like? Thanks and Kind Regards in advance for any help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I concantenate two columns for the length of a table?
Sub PutTogether()
lastRow = Cells(Rows.Count, 1).End(xlUp).Row For i = 2 to lastRow '<<assumes header row Range("C" & i) = Cells(i, 1) & " " & Cells(i, 2) Next End Sub "zach-18" wrote: I have a daily report in which I need to combine the 1st and last name. I would like to write a macro that would concatenate the report, regardless of the number of rows. If the 1st name is in Col A, last name is in Col B, and the combined would go in Col C, what would the VBA text look like? Thanks and Kind Regards in advance for any help. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I concantenate two columns for the length of a table?
Assuming your data starts in Row 2, have you considered putting this...
=A2&" "&B2 in C2 and copying it down far enough to cover the maximum possible row you ever expect to use? That way, the concatenation operation would take immediately without you have to manually run a macro. Rick "zach-18" wrote in message ... I have a daily report in which I need to combine the 1st and last name. I would like to write a macro that would concatenate the report, regardless of the number of rows. If the 1st name is in Col A, last name is in Col B, and the combined would go in Col C, what would the VBA text look like? Thanks and Kind Regards in advance for any help. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I concantenate two columns for the length of a table?
You hit the nail on the head! thanks so much, you saved me hours of time.
"JLGWhiz" wrote: Sub PutTogether() lastRow = Cells(Rows.Count, 1).End(xlUp).Row For i = 2 to lastRow '<<assumes header row Range("C" & i) = Cells(i, 1) & " " & Cells(i, 2) Next End Sub "zach-18" wrote: I have a daily report in which I need to combine the 1st and last name. I would like to write a macro that would concatenate the report, regardless of the number of rows. If the 1st name is in Col A, last name is in Col B, and the combined would go in Col C, what would the VBA text look like? Thanks and Kind Regards in advance for any help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Concantenate columns with dates and text | New Users to Excel | |||
Concantenate columns with dates and text | Excel Discussion (Misc queries) | |||
Concantenate columns with dates and text | Excel Worksheet Functions | |||
pre-set the length of columns | New Users to Excel | |||
different length columns | Excel Discussion (Misc queries) |