+ Reply to Thread
Results 1 to 6 of 6

Select & Clear Entire Row Based on Cell Value

  1. #1
    Forum Contributor
    Join Date
    01-30-2011
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    102

    Select & Clear Entire Row Based on Cell Value

    The idea is that a value is dropped into a cell (A3) via a drop down list

    I would like the entire row that that particular value exists to be selected and then after a messagebox warning, clear the contents of that row. The first row that any data exists starts at A15, and the last column of data would be column AF

    Thanks in advance.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Select & Clear Entire Row Based on Cell Value

    If you turn on the AutoFilter in row 14, then you can use A14 to do the same thing, except when you make your choice you'll already be looking at that row.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    01-30-2011
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    102

    Re: Select & Clear Entire Row Based on Cell Value

    Is there some simple code to select the specific row based on my OP? There's more to it than what I just posted, but if I can at least get the proper row selected, I'm sure I can figure out the rest.

  4. #4
    Valued Forum Contributor gjlindn's Avatar
    Join Date
    08-01-2011
    Location
    Dodgeville, WI
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    369

    Re: Select & Clear Entire Row Based on Cell Value

    Put this in your worksheet module.
    Please Login or Register  to view this content.
    And this in a standard module
    Please Login or Register  to view this content.
    Last edited by gjlindn; 08-27-2011 at 09:30 PM.
    -Greg If this is helpful, pls click Star icon in lower left corner

  5. #5
    Forum Contributor
    Join Date
    01-30-2011
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    102

    Re: Select & Clear Entire Row Based on Cell Value

    Thanks for the reply

    I have set up the code as suggested, but nothing happens. If it matters, because I know sometimes it does, A3 is actually merged with B3, and it is necessary as the merged cells form a drop down box.

    Also, is there a way to tie this directly into a command button. There will almost always be some data in cell A3, and I don't need this to fire every time.

    Thanks for your time, and going forward if it seems my responses are delayed, it's because we are gearing up for that really large orange mass on the weather map..........

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Select & Clear Entire Row Based on Cell Value

    Zoo, you can attached the macro ClearRowContents to a Forms command button as is, and remove the ws_change macro altogether since you don't want it to be automatic.

    Without a ws_change operating on that sheet, you probably don't need all the extra Application stuff at the top and the bottom, and I would suggest just the ScreenUpdating is all you need unless there is a lot of other things going on. Since you're only deleting one row, there's really minimal benefit to any of it.

    Also, on the FIND command, you should always include the LookIn parameter, too. The FIND method is one of the few features that previous uses of the the feature are remembered by Excel. If you do not specify the LookIn and the LookAt paramaters, they could be anything! The "defaults" are not guaranteed, so always include them:
    Please Login or Register  to view this content.

+ 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