+ Reply to Thread
Results 1 to 6 of 6

How to delete cells (i.e. make a blank cell) if numbers are negative

  1. #1
    Registered User
    Join Date
    06-22-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    28

    How to delete cells (i.e. make a blank cell) if numbers are negative

    Folks,
    I am very new to VBA and want to know how to delete cells containing any number less than 0 (i.e. negative value) using Excel VBA.
    I'd like to do it for all rows (more than 80000) in column E, F, G, H.

    For example

    a.JPG

    then the result should look like

    b.JPG

    making every negative number cell "blank".
    Can anyone give me the code to do this?

    Thank you in advance for your help.
    Last edited by geomatics; 06-22-2012 at 04:06 PM.

  2. #2
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: How to delete cells (i.e. make a blank cell) if numbers are negative

    try this, just record a macro!
    Please Login or Register  to view this content.
    Last edited by john55; 06-22-2012 at 04:38 PM.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  3. #3
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: How to delete cells (i.e. make a blank cell) if numbers are negative

    hi try this code:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Re: Add one more reference for you to choose

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-22-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: How to delete cells (i.e. make a blank cell) if numbers are negative

    Hi I tried and it is giving me a run time error. Do you know what might be causing this problem?
    THanks!

  6. #6
    Registered User
    Join Date
    06-22-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Add one more reference for you to choose

    Thanks it works perfectly fine!

    Quote Originally Posted by geomatics View Post
    Hi I tried and it is giving me a run time error. Do you know what might be causing this problem?
    THanks!
    Quote Originally Posted by Sa DQ View Post
    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