Consulting

Results 1 to 2 of 2

Thread: Sleeper: ORDERING...

  1. #1

    Sleeper: ORDERING...

    i use this macro to ordering the column G but tath dont work correctlly...
    after to run this macro many number assuming a point and not a comma, why?

    In effect i would want to order the columnn G...
    If you have another way is welcome...

    Sub ORD_ASS_CDI_50()
    Sheets("L0785_CDI_50").Select
    With Range(Range("G7"), Range("G65536").End(xlUp))
    .NumberFormat = "0.00"
    .TextToColumns Destination:=Range("G7")
    End With
    Range("A7:X7").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Sort Key1:=Range("G7"), Order1:=xlAscending, Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    Range("A7").Select
    End Sub
    Sal
    1 help 1 pizza
    2 help 1 pizza 1 caff?
    3 help 1 pizza 1 caff? 1 mozzarella
    ...
    Spaghetti, Lasagne and Tortellini for the "Lady" ;-)

  2. #2
    VBAX Regular HaHoBe's Avatar
    Joined
    Aug 2004
    Location
    Hamburg
    Posts
    89
    Location
    Hi, Sal,

    to my opinion the line

    .TextToColumns Destination:=Range("G7")
    is the line that should be made responsible for the 'strange' behaviour.

    The following code worked fine in the workbook:

    Sub ORD_ASS_CDI_50_mod()
    With Sheets("L0785_CDI_50")
      With .Range(.Range("G7"), .Range("G65536").End(xlUp))
        .NumberFormat = "0.00"
      End With
      With .Range(.Range("A7:X7"), .Range("A7:X7").End(xlDown))
        .Sort Key1:=Range("G7"), Order1:=xlAscending, Header:=xlGuess, _
          OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
      End With
    End With
    End Sub

    Ciao,
    Holger

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •