excel merge cells with VBA macro
Can anyone help me with a VBA macro to merge two non-blank cells into a third (blank) cell with a space between the text data? For example, part numbers (12345) in column A or B, Description (XYZ) in column C. The output should be in column D (12345 XYZ). Note: My data file is created from a data base that is not consitent in terms of data entry for column A and B. The result is sometimes the part number is in A and sometimes in B. I need to import the column D (output) data into another database, my peachtree accounting software. Option: I could add the text from A or B into C and not use D if that is easier.
Thanks in advance for any help.
Re: excel merge cells with VBA macro
Assuming that your data starts in cell A2, i.e Row 1 contains headers, then copy this formula into cell D2 and fill it down.
Code:
=IF(ISBLANK(A2),B2,A2)&" "&C2
Re: excel merge cells with VBA macro [Resolved]
DKenny sorry for my late reply, thanks, this works!