+ Reply to Thread
Results 1 to 9 of 9

Removing cells based on adjacent blanks

  1. #1
    Forum Contributor
    Join Date
    02-20-2007
    Location
    Alaska
    MS-Off Ver
    2003, 2007, 2010
    Posts
    105

    Removing cells based on adjacent blanks

    I have this sheet that I need to search down column C, find a blank, then clear cells A thru E. This must be done until there is no more data in cell A.

    TIA!
    Attached Images Attached Images

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by F6Hawk
    I have this sheet that I need to search down column C, find a blank, then clear cells A thru E. This must be done until there is no more data in cell A.

    TIA!
    Hi,

    a macro something like
    Please Login or Register  to view this content.
    should do the trick.

    hth
    ---
    Si fractum non sit, noli id reficere.

  3. #3
    Forum Contributor
    Join Date
    02-20-2007
    Location
    Alaska
    MS-Off Ver
    2003, 2007, 2010
    Posts
    105
    Thanks Brian, this is close, I think. But can I change

    Rows(iRow).EntireRow.Delete

    to

    Rows(iRow).Range(A-E).ClearContents
    ?

    I don't want to delete the entire row, just clear cells A thru E to make it look cleaner.

    Thanks a bunch!
    Hawk

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Try this macro

    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  5. #5
    Forum Contributor
    Join Date
    02-20-2007
    Location
    Alaska
    MS-Off Ver
    2003, 2007, 2010
    Posts
    105
    Mudraker,

    This did nothing for a bit, then all of a sudden, all values in the Range(A:E) were cleared (not just rows that had blank cells in C). The logic makes sense to me, but something is amiss.

    Thanks for the idea though!

  6. #6
    Forum Contributor
    Join Date
    02-20-2007
    Location
    Alaska
    MS-Off Ver
    2003, 2007, 2010
    Posts
    105
    This seems to be working, I kind of used the logic of the two examples:

    Please Login or Register  to view this content.
    My question now is, can I somehow clear the contents on a range of cells, instead of doing 5 cells per row individually? I tried:

    Range(iRow, 1, 5).ClearContents

    But it did not work.
    Last edited by F6Hawk; 02-28-2007 at 08:01 AM.

  7. #7
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by F6Hawk
    Thanks Brian, this is close, I think. But can I change

    Rows(iRow).EntireRow.Delete

    to

    Rows(iRow).Range(A-E).ClearContents
    ?

    I don't want to delete the entire row, just clear cells A thru E to make it look cleaner.

    Thanks a bunch!
    Hawk
    Hi,

    Please Login or Register  to view this content.
    should help

    (sorry about the Delete Row)

    ---

  8. #8
    Forum Contributor
    Join Date
    02-20-2007
    Location
    Alaska
    MS-Off Ver
    2003, 2007, 2010
    Posts
    105
    Bryan, you DA MAN!! Thank you, Sir, this does it nicely.

    Thanks goes out to mudraker, as well, you guys are what make this forum so great!

  9. #9
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by F6Hawk
    Bryan, you DA MAN!! Thank you, Sir, this does it nicely.

    Thanks goes out to mudraker, as well, you guys are what make this forum so great!
    good to see it worked for you. mudraker's idea is better, use the Find rather than loop through each row, but for simplicity I sometimes take the easy route.

    Thanks for your response.
    ---

+ 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