+ Reply to Thread
Results 1 to 6 of 6

VBA delete rows based on cell value

  1. #1
    Registered User
    Join Date
    09-27-2015
    Location
    BEIRUT
    MS-Off Ver
    2016
    Posts
    77

    VBA delete rows based on cell value

    Hello
    please i need your help

    I am trying to create VBA to delete the row on a Worksheet named "Sheet1" when the value of the cell in Column G contains X
    so example value in Cell G3 = X, therefore row 3 should be deleted.
    The number of rows can vary with a max of 100 lines

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,952

    Re: VBA delete rows based on cell value

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 04-16-2024 at 10:27 AM.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    09-27-2015
    Location
    BEIRUT
    MS-Off Ver
    2016
    Posts
    77

    Re: VBA delete rows based on cell value

    Bernie Deitrick
    thanks for your help
    But VBA is not auto running when data is entered directly in the cell

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: VBA delete rows based on cell value

    Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your Sheet1 and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Enter an uppercase "X" in column G and press the ENTER" key.

    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  5. #5
    Registered User
    Join Date
    09-27-2015
    Location
    BEIRUT
    MS-Off Ver
    2016
    Posts
    77

    Re: VBA delete rows based on cell value

    Yes!
    That worked perfectly.
    Thank you very much Mumps1.

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: VBA delete rows based on cell value

    You are very welcome.

+ 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. Delete rows based on Cell Value
    By rmathisen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-29-2022, 03:15 AM
  2. [SOLVED] Delete Rows based on cell value, highlight based on cell value and keep deleted data
    By jaredli in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-21-2020, 06:37 AM
  3. [SOLVED] BEST way to delete rows based on cell value
    By EchoPassenger in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-22-2017, 01:51 PM
  4. Delete rows based on the value of a cell
    By Emma_B in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-04-2013, 05:35 PM
  5. Delete certain rows based on value in another cell
    By angelk in forum Excel General
    Replies: 1
    Last Post: 07-30-2012, 02:38 PM
  6. Delete Rows based on cell value and then Insert rows alternatively with a formula
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-11-2008, 04:27 PM
  7. Delete rows based on Cell name
    By gmunro in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-25-2005, 09:15 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