+ Reply to Thread
Results 1 to 10 of 10

Deleting Rows based on their value

  1. #1
    Registered User
    Join Date
    06-23-2008
    Posts
    8

    Deleting Rows based on their value

    Hi,
    I am having trouble with the .SpecialCells(xlCellTypeBlanks)
    What I need to do is for a macro to first go through a range ("G8:G50"), Add a 0 value to any blank cell.
    Then I want the macro to delete the entire row for any of the cells that have a value of 0 in that range of "G8:G50"
    Last edited by peteynub; 06-26-2008 at 09:57 AM.

  2. #2
    Registered User
    Join Date
    06-23-2008
    Posts
    8
    I'm sorry, I meant to say add a 0 value to any blank cell.

  3. #3
    Registered User
    Join Date
    06-23-2008
    Posts
    8
    Anyone give me a little bit of help?

  4. #4
    Registered User
    Join Date
    06-23-2008
    Posts
    8
    Please? Any sugestions?

  5. #5
    Forum Contributor
    Join Date
    10-08-2006
    Location
    Walnut, CA
    MS-Off Ver
    2003,2010, Office 365
    Posts
    114
    Hi,
    Give this a try!
    Please Login or Register  to view this content.
    Tony

  6. #6
    Registered User
    Join Date
    06-23-2008
    Posts
    8
    I apprciate the try tony, but that didn't work.
    It deleted everything and left some with blank cells in column G.
    I have attached an example of what I am trying to do.
    In the attachement, I copied that sheet from the workbook that I'm working on. I didn't include the entire workbook since the file is too large. But the example I have should be sufficent.
    If you look at that sheet, you will see there are items with blank cells in Collum G and there are few items with actual cost, like G13, and G19, and G33.
    I basically want to delete all the rows that have blank or zero values for Column G. So my idea was to assigne every cell in colum G8:G50 to zero if it is blank. That will make every cell in that range have a value of either 0 or a number greater than zero. Then it would scan the column for cells with zero values and delete them since I only want to show items that have a cost.

  7. #7
    Registered User
    Join Date
    06-23-2008
    Posts
    8
    the attachement:
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    10-08-2006
    Location
    Walnut, CA
    MS-Off Ver
    2003,2010, Office 365
    Posts
    114
    Hi,
    I don't think you need to find the blanks and change them into 0. Try this instead,
    Please Login or Register  to view this content.
    Tony

  9. #9
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327
    Hi Tony and peteynub,

    I noticed that some cells in peteynub's spreadsheet had 2 spaces in them as well as cells with 0 in them so changed your (Tony's) code to the following:

    Please Login or Register  to view this content.
    Hope this helps

    Seamus

  10. #10
    Registered User
    Join Date
    06-23-2008
    Posts
    8
    Thank you very much Tony, problem solved.
    SOS, thats great observation skills. I missed that and I'm impressed you noticed it since its really to notice.
    Thanks again guys, well appriciated it.

+ 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