+ Reply to Thread
Results 1 to 15 of 15

if column equals text string clear cells

  1. #1
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    if column equals text string clear cells

    Hello,
    I would like to clear the value in every cell in the row, when column B = "R"

    please help

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,719

    Re: if column equals text string clear cells

    try this:

    Please Login or Register  to view this content.
    If you meant to clear the row of data and not delete the row, then change delete to clear in the code and the row will remain, however empty of data.
    Last edited by alansidman; 12-15-2013 at 10:59 PM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: if column equals text string clear cells

    One way:

    Please Login or Register  to view this content.
    Last edited by berlan; 12-15-2013 at 11:01 PM. Reason: update

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: if column equals text string clear cells

    Another:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: if column equals text string clear cells

    Hi guys thank for your great replies,
    will this clear (not delete) the data in other columns or just B?

    the data range I wish to clear is D:BC, based on the value in B

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,719

    Re: if column equals text string clear cells

    If you look at the code I provided, it deletes the entire row. Replace the word delete with clear and it will clear the entire row. The other codes provided clear the contents of the cells. Have you tested any of the solutions?

  7. #7
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: if column equals text string clear cells

    Wow! that was quick, thanks Alansidman, I don't want to delete the data in rows A:C or (BD onwards)

  8. #8
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: if column equals text string clear cells

    Or shoud I say clear? No deleting please

  9. #9
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: if column equals text string clear cells

    If you want to Clear only D:BC.. try this one too..

    Please backup a copy before try..

    Please Login or Register  to view this content.
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,719

    Re: if column equals text string clear cells

    This should do that for you

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: if column equals text string clear cells

    I will do, made that mistake before

    its falling over because I have merged cells, maybe a more specific range might help? the range is D7:BC300.

    I am also using groups (Hidden) will this be able to clear them too?

  12. #12
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,719

    Re: if column equals text string clear cells

    VBA does not play well with merged cells. If you want to use VBA, you will need to avoid the use of merged cells.

  13. #13
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: if column equals text string clear cells

    Merged cells don't seem to play with any of the other kids.
    I don't think I'll be able to avoid it though, but there are no merged cells in the D7:BC300 range.

  14. #14
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: if column equals text string clear cells

    Can we have a better view.. please upload sample file..

  15. #15
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: if column equals text string clear cells

    Hi Debraj Roy,
    Sorry I am unable to upload files from my workplace.

+ 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] Apply formatting when column header equals string
    By maw230 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-20-2013, 04:24 PM
  2. [SOLVED] How to Extract A Number from String if Text within the String Equals XYZ
    By tyrsfury in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-15-2012, 03:30 PM
  3. Delete rows in all worksheets where column A equals string
    By excelforum123 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-13-2010, 09:25 AM
  4. copying cells when column A equals certain text, loop function?
    By djl304 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2009, 09:13 PM
  5. IF text string equals certain criteria then specified calculation
    By davemojo82 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-14-2009, 08:06 AM

Tags for this Thread

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