+ Reply to Thread
Results 1 to 4 of 4

Improve code to delete cells with a value of 0

  1. #1
    Registered User
    Join Date
    08-02-2005
    Posts
    7

    Improve code to delete cells with a value of 0

    I have a sheet with 2884 rows.. I am currently using the following macro (with changes for each column) to search columns AN - BG and delete cells with a value of 0 and move the columns that do not = 0 up..

    for example:

    0
    0
    0
    0
    5
    0
    0
    3
    0
    0
    0
    1

    would be

    5
    3
    1

    I can not delete the entire row, because the next column may not have a 0 value in the same row..

    Obviously, the process I have below takes FOREVER. Is there a faster way to do this? Again, it is Column AN through Column BG and rows 6-2884 . I am going through it backwards so that I do not miss any 0's.

    Please Login or Register  to view this content.
    Last edited by VBA Noob; 09-18-2008 at 04:40 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    Try removing screen updating at the beginning of your code.
    Please Login or Register  to view this content.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Maybe
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-02-2005
    Posts
    7
    I appreciate the help, however both of those still end up taking over an hour to process. Would it be faster to somehow go down the row and only copy the cells the do not equal 0 to a different row?

+ 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. Adaptation of code to delete data
    By Dave32 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-20-2008, 06:59 PM
  2. Toggle Code to format-unformat range of cells
    By Zimbo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-09-2008, 03:01 AM
  3. Delete with shift causes cells loose fill & border around
    By mikeburg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2008, 03:40 AM
  4. Replies: 2
    Last Post: 01-10-2008, 07:40 AM
  5. Excel closes when using VBA to write VBA code
    By btoback in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-04-2007, 03:42 PM

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