+ Reply to Thread
Results 1 to 6 of 6

VBA to combine texts from cells to a single based on another cell value

  1. #1
    Forum Contributor
    Join Date
    10-03-2012
    Location
    USA
    MS-Off Ver
    2010
    Posts
    496

    VBA to combine texts from cells to a single based on another cell value

    Hi,
    I need VBA to search the rows to find the text in column A if it has more than 4 chracters and another has a value of "Yes". If yes, then it will combine text from each cell to one string. If text does not have more than 4 chracters, then it will the text in that cell. There is problem for one full string which will be cross cells which have formulas and pasted vlaue(empty blanks).

    Can someone help me to solve this problem.

    Thanks in advance,

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: VBA to combine texts from cells to a single based on another cell value

    Hello Rocky2013,

    There is a problem. VBA can not replace a value generated by a formula in a cell without deleting the formula in the cell. You will either have to commit to formulas or to VBA. You can not use both in this situation.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    10-03-2012
    Location
    USA
    MS-Off Ver
    2010
    Posts
    496

    Re: VBA to combine texts from cells to a single based on another cell value

    Hi Leith Ross,
    If I unstand I need to manually to delete the fromulas in b20, C20 and D20; B22,C22 and D22?

    I must have formulas in all 4 cells. I am end up with problem that I use VBA to copy and paste special (value) to those so the text is across cells.
    Currently I have 70 rows and data, three rows have long texts more than 4 chracters that I need to manual delete the blank (formula) in column
    B, C and D.

    Can VBA clear blank cell contents? When I used VBA to copy and pasted value to the cells. I click cell B20, I see a blank but no formula; why B20 blocking
    the text in A20? When I hit a delete key, then the text will cross that cell.

    Thanks

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: VBA to combine texts from cells to a single based on another cell value

    Hello Rocky2013,

    Do you have a workbook with before and after examples?

  5. #5
    Forum Contributor
    Join Date
    10-03-2012
    Location
    USA
    MS-Off Ver
    2010
    Posts
    496

    Re: VBA to combine texts from cells to a single based on another cell value

    Hi,
    Sorry, I do have but company confidential I could not share. That why I create the representive sample. As I commented before, if I can use VBA to search the text length,
    > find the row number > clear contents for cells in Col B,C,D. If I can not get it working, my backup will join all text from 4 cells, but not using clear content. The reason
    I do that is I think text will look better and even space between words, not affecting by row width.

    I am very appreciate your help.

  6. #6
    Forum Contributor
    Join Date
    10-03-2012
    Location
    USA
    MS-Off Ver
    2010
    Posts
    496

    Re: VBA to combine texts from cells to a single based on another cell value

    Hi,
    Hope if there is solution to this using VBA. Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Combine multi-value rows into a single row based on a Primary Key
    By bocrad75 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-21-2013, 05:20 PM
  2. [SOLVED] Combine Several Cells into a New Cell Based on Criteria
    By Exia in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-14-2012, 06:15 PM
  3. Need to combine cells based on first cell
    By jjbigfish in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-17-2012, 05:40 PM
  4. Breaking Texts into lines of words in a single cell vba
    By andywsw in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-15-2012, 11:51 PM
  5. combine parts of texts from few cells into one
    By Ramzes in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-07-2010, 02:38 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1