Results 1 to 3 of 3

Thread: excel merge cells with VBA macro

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Location
    San Jose
    Posts
    2

    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.

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    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
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2006
    Location
    San Jose
    Posts
    2

    Resolved Re: excel merge cells with VBA macro [Resolved]

    DKenny sorry for my late reply, thanks, this works!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width