+ Reply to Thread
Results 1 to 5 of 5

VBA delete rows based on AND IF condition

  1. #1
    Registered User
    Join Date
    07-01-2020
    Location
    Yerevan
    MS-Off Ver
    2010
    Posts
    44

    VBA delete rows based on AND IF condition

    Hi All,

    I have an excel file where in column G are listed transaction amounts and in Column H corresponding currency (USD, EUR and etc.).

    G H
    Row 1 5000 USD
    Row 2 300 GBP
    Row 3 150 USD
    etc...

    I want to write a VBA such that excel will delete rows when:

    1. Transactions that do not exceed 10,000 USD
    2. Transactions that do not exceed 8,000 EUR
    3. Transactions that do not exceed 5,000 GBP

    Many thanks for your help.


    screenshot1.JPG

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA delete rows based on AND IF condition

    Hi,

    I'd create a helper column that contains a formula that returns a value, say "delete" when any of those conditions is true.

    Then you'll need a macro to fliter your data for the 'delete' cells and then deletes the rows.

    If you need further help you'll need to upload the workbook.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Valued Forum Contributor
    Join Date
    12-14-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    439

    Re: VBA delete rows based on AND IF condition

    Try this
    Please Login or Register  to view this content.
    ❖ Please mark your thread is SOLVED if there has been offered a solution that works fine for you.

    ❖ If you like solutions provided by anyone, feel free to add reputation by clicking on ✶ Add Reputation bottom left of their posts.

  4. #4
    Registered User
    Join Date
    07-01-2020
    Location
    Yerevan
    MS-Off Ver
    2010
    Posts
    44

    Re: VBA delete rows based on AND IF condition

    thank you very much this works perfectly

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,777

    Re: VBA delete rows based on AND IF condition

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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] Delete Rows Based on Condition
    By gxm100 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-28-2018, 12:27 PM
  2. [SOLVED] Delete Rows in Excel Using VBA Based on Condition
    By mayaincaztec in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-26-2015, 09:41 AM
  3. Delete rows based on more than one condition
    By Steve2107 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-16-2014, 06:16 AM
  4. Macro to delete all rows based on one condition
    By vemix in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-30-2012, 05:24 AM
  5. Delete rows based on condition
    By elocin17 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2012, 12:35 PM
  6. Delete rows based on a condition
    By sakinen in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-20-2009, 09:14 AM
  7. A loop to delete rows based on condition
    By Josh_123456 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-21-2007, 05:51 PM

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