![]() |
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. |
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. |
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. |
All times are GMT +1. The time now is 12:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com