+ Reply to Thread
Results 1 to 12 of 12

macro ascending/descending

  1. #1
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    macro ascending/descending

    Hello to all.
    I ask to help to understand why the macro does not report the value in descending into row 2.
    I am attaching an example.
    max max
    Attached Files Attached Files

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,376

    Re: macro ascending/descending

    maybe so
    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 2016 (Windows)
    Posts
    5,355

    Re: macro ascending/descending

    The macro works perfectly, but your 'blank' cells are not really blank. So, first, sort using your ascending macro, scroll down to the first 'blank' cell in column C, then delete everything from there down, and your macros will work the way you expect them to.
    Bernie Deitrick
    Excel MVP 2000-2010

  4. #4
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro ascending/descending

    Thanks nilem I think it works well.

    Bernie Deitrick i know that empty cells are not quite empty but there is
    the formulas and then for the macro it is as if they were empty.

    Greetings from Italy at all.
    max_max

  5. #5
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 2016 (Windows)
    Posts
    5,355

    Re: macro ascending/descending

    Then just be aware that converting to values removes the formulas permanently.

  6. #6
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro ascending/descending

    Ah that's why I can not see the formulas
    I thought it was me.
    Then the macro nilem does not work perfectly.
    max_max

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 2016 (Windows)
    Posts
    5,355

    Re: macro ascending/descending

    The solution depends on what you are doing with the other columns, and whether they are constants or formulas - I think code like this will work for all cases:
    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 11-01-2016 at 02:31 PM.

  8. #8
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro ascending/descending

    Thanks Bernie,
    I think it's perfect.
    It also works with formulas.
    Tomorrow I try it in my office.
    A greeting and thanks again.
    max_max

  9. #9
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro ascending/descending

    Bernie curiosity:
    if the sheet there are other columns as last column is H here:

    lngR = Application.Evaluate ("SUMPRODUCT((LEN(C1:C15000)>0)*1)")

    I have to change in H?
    max_max

  10. #10
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 2016 (Windows)
    Posts
    5,355

    Re: macro ascending/descending

    Change it to the column that you are actually sorting on - if that is H:

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro ascending/descending

    O.k. bernie
    thank you again
    max_max

  12. #12
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro ascending/descending

    Thanks Bernie,
    I tried the macro in my office and it works well.
    Thanks again.
    max_max

+ 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. macro ascending/descending
    By max_max in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2016, 10:37 AM
  2. How do you do Ascending - Descending within same Code
    By Aeneren in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-31-2014, 09:18 PM
  3. A macro that sorts a list ascending and descending
    By tabfri in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-19-2013, 04:13 AM
  4. macro to sort in ascending/descending order
    By apio in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2012, 02:46 AM
  5. Ascending and descending multiple columns with macro
    By leo73pk in forum Excel General
    Replies: 7
    Last Post: 01-03-2011, 05:28 AM
  6. ascending - descending
    By Bonnie WLU in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 06-17-2009, 08:53 AM
  7. one macro to sort text in ascending and descending order
    By jpruffle in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-13-2008, 10:24 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