+ Reply to Thread
Results 1 to 11 of 11

Concatenate only where there is data

  1. #1
    Registered User
    Join Date
    06-17-2011
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    52

    Smile Concatenate only where there is data

    Hi All,
    I created a macro (mostly by copying/pasting macros from other posts and tweeking) that:
    1. Inserts a column C
    2. Concatenates A+B into the new column C,
    3. Pastes the values
    4. Shades every other block of new data within column C, and
    5. Deletes the column C that was created.

    The issue that I am having is the fact I don't know how to limit all of the above to only rows that have data in column B. In other words, the macro is doing this for 65,000 lines! How could I limit the above to only rows with data in column B?

    Please Login or Register  to view this content.
    As always, thank you kindly for any assistance you are able to offer.
    Bryan
    Last edited by tiger10012; 10-05-2011 at 03:57 PM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Concatenate only where there is data

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-17-2011
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    52

    Re: Concatenate only where there is data

    Thank you very much for the information Kenneth. When I ran the updated macro, I received an "Overflow" message. There were 2 places where I incorporated the "& lrColB". Did I mess up my updates? Here is the updated code:
    Please Login or Register  to view this content.

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Concatenate only where there is data

    Sorry, forgot the rows part.

    Please Login or Register  to view this content.
    I don't use the SpecialCells method because it only updates after a save. Use a method like mine.

  5. #5
    Registered User
    Join Date
    06-17-2011
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    52

    Re: Concatenate only where there is data

    I get a "400" error code when I run the macro now. I have trimmed the code to this, and still get the "400" error code:
    Please Login or Register  to view this content.

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Concatenate only where there is data

    Diet coke withdrawal I guess:
    Please Login or Register  to view this content.
    Last edited by Kenneth Hobson; 10-05-2011 at 03:39 PM.

  7. #7
    Registered User
    Join Date
    06-17-2011
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    52

    Re: Concatenate only where there is data

    Still getting the "400" error message

  8. #8
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Concatenate only where there is data

    I like to use this method:
    Please Login or Register  to view this content.
    Or
    Please Login or Register  to view this content.

  9. #9
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Concatenate only where there is data

    Quote Originally Posted by Kenneth Hobson View Post
    I don't use the SpecialCells method because it only updates after a save. Use a method like mine.
    Oops. Didn't read fully before posting. I didn't realize that specialcells use the last saved values. Thanks.

  10. #10
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Concatenate only where there is data

    Use xLup rather than xOneUp.
    Last edited by Kenneth Hobson; 10-05-2011 at 03:40 PM.

  11. #11
    Registered User
    Join Date
    06-17-2011
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    52

    Re: Concatenate only where there is data

    There were 2 things going on:
    1. My blindness, and
    2. The error code 400 will appear if there is no data on the spreadsheet. When I was troubleshooting, I kept moving components of code to new spreadsheets. Didn't think to take the data as well.

    Thank you very much everyone!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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