+ Reply to Thread
Results 1 to 11 of 11

Select a range, remove 0 values returned from formula, shift all others left

  1. #1
    Registered User
    Join Date
    05-31-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    6

    Select a range, remove 0 values returned from formula, shift all others left

    I need a macro that will selct a range, remove the cells that a formula returned as zero, then shift all others left.
    Thanks,
    Gabby11

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Select a range, remove 0 values returned from formula, shift all others left

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-31-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Select a range, remove 0 values returned from formula, shift all others left

    Range(Right(del_range, Len(del_range) - 1)).Delete shift:=xlToLeft

    It's telling me this part doesn't work.
    Any ideas?

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Select a range, remove 0 values returned from formula, shift all others left

    I tested it and it worked ok. I guess if you had no 0 cells in your range then it would give you an error. Can you attach your workbook?

  5. #5
    Registered User
    Join Date
    05-31-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Select a range, remove 0 values returned from formula, shift all others left

    I think it attached...
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Select a range, remove 0 values returned from formula, shift all others left

    What is the range you want to look at?

  7. #7
    Registered User
    Join Date
    05-31-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Select a range, remove 0 values returned from formula, shift all others left

    The Cell range is A51:p76

    I want it to show the weeks in column 1 and then the codes without the blanks in between.

  8. #8
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Select a range, remove 0 values returned from formula, shift all others left

    I think it's because there were too many cells to delete, that way would have a limit of the number of characters you could use to select the range. Use this instead:
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-31-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Select a range, remove 0 values returned from formula, shift all others left

    It worked. Is there a way to (for lack of better word) unrun the macro. How do I go back to my formulas so I can make changes up above and run it again?

  10. #10
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Select a range, remove 0 values returned from formula, shift all others left

    You can't unrun it, there would be no record of which cells it deleted.

  11. #11
    Registered User
    Join Date
    05-31-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Select a range, remove 0 values returned from formula, shift all others left

    Can I add to this macro.
    After run macro to add a column on left.
    In each row down, if there are two codes to add phrase 'Book Ends' and if only one code or no codes for that week to leave blank.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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