Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Using Macro To Merge Two Columns

hello. here's the situation i need a little help with.

i have two columns.....A and B.

both columns hold email addresses. if there is an email
address for a particular record in column A then there is
no email address in column B, and vice versa.

i would like to create a macro that will merge the two.
how can i do this? thank you very much.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Using Macro To Merge Two Columns

Josh,

This will replace column A with the addresses [watch for word wrap]
Change the 1 in Cells(x, 1) to whatever if you want it in a different
column.

Dim lrow As Long, x As Long

' determine number of rows
lrow = WorksheetFunction.Max(Cells(Rows.Count, "A").End(xlUp).Row, _
Cells(Rows.Count, "B").End(xlUp).Row)

' loop and replace
For x = 1 To lrow
Cells(x, 1) = Cells(x, 1) & Cells(x, 2)
Next

--
sb
"Josh in Tampa" wrote in message
...
hello. here's the situation i need a little help with.

i have two columns.....A and B.

both columns hold email addresses. if there is an email
address for a particular record in column A then there is
no email address in column B, and vice versa.

i would like to create a macro that will merge the two.
how can i do this? thank you very much.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using Macro To Merge Two Columns

Dim rng as Range
Dim cell as Range
On Error Resume Next
set rng = Columns(1).SpecialCells(xlBlanks)
On Error goto 0
if not rng is nothing then
for each cell in rng
cell.Value = cell.Offset(0,1).Value
cell.Offset(0,1).ClearContents
Next
End If



--
Regards,
Tom Ogilvy

"Josh in Tampa" wrote in message
...
hello. here's the situation i need a little help with.

i have two columns.....A and B.

both columns hold email addresses. if there is an email
address for a particular record in column A then there is
no email address in column B, and vice versa.

i would like to create a macro that will merge the two.
how can i do this? thank you very much.



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
Macro to merge 3 rows multi times, columns A:K only Steve Excel Worksheet Functions 0 November 19th 09 05:37 PM
merge columns into single report - macro needed aquaflow Excel Discussion (Misc queries) 2 February 5th 07 12:41 PM
merge text from 2 columns into 1 then delete the old 2 columns sleepindogg Excel Worksheet Functions 4 March 30th 06 07:25 PM
I want to merge two columns Andrew New Users to Excel 3 October 26th 05 03:45 AM
How to merge columns Pete Excel Worksheet Functions 7 April 26th 05 12:15 PM


All times are GMT +1. The time now is 09:05 AM.

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

About Us

"It's about Microsoft Excel"