Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
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
Concantenate columns with dates and text Dazed and Confused[_2_] New Users to Excel 4 April 4th 09 01:07 PM
Concantenate columns with dates and text Dazed and Confused[_2_] Excel Discussion (Misc queries) 2 April 4th 09 01:04 PM
Concantenate columns with dates and text Dazed and Confused[_2_] Excel Worksheet Functions 2 April 4th 09 01:02 PM
pre-set the length of columns Dave[_8_] New Users to Excel 1 September 6th 08 04:07 PM
different length columns dsal Excel Discussion (Misc queries) 5 July 5th 05 06:27 PM


All times are GMT +1. The time now is 02:49 AM.

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"