+ Reply to Thread
Results 1 to 6 of 6

Filling Empty Cells with Zeroes

  1. #1
    Registered User
    Join Date
    04-22-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Filling Empty Cells with Zeroes

    I have a macro to extract and sort the data I want from complicated, messy charts used at my job, and it works well except that empty cells in the selected area cause it to miscount the rows and so omit data. Could someone please guide me to a piece of code that would fill any empty cells in a selected area with zeroes? Thanks in advance.

    This is the row-counting function that malfunctions when empty cells are present:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Filling Empty Cells with Zeroes

    Maybe easier to use this.

    Please Login or Register  to view this content.
    Martin

  3. #3
    Registered User
    Join Date
    06-07-2012
    Location
    Tucson, Arizona
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Filling Empty Cells with Zeroes

    It might not be what you're looking for, but I'd suggest putting if statements in the problem cells. You would be creating a second table, which copies all nonzero values from the original, and fills the rest with zeroes.

    EX: IF(A1<>0,A1,0)

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,297

    Re: Filling Empty Cells with Zeroes

    Use something like:

    Please Login or Register  to view this content.
    to get the last row of data in column B.

    Then you can process each row from whatever to lLR

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    04-22-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Filling Empty Cells with Zeroes

    Thank you very much, gentlemen--problem solved.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,297

    Re: Filling Empty Cells with Zeroes

    You're welcome. Thanks for the rep.

    Regards, TMS

+ 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