Results 1 to 10 of 10

Thread: "orientaion" parameter in vba SORT

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Apr 2019
    Location
    London
    Posts
    25
    Location

    "orientaion" parameter in vba SORT

    The following statements, as part of a VBA sort routine, work as intended.

    With ActiveWorkbook.Worksheets(Sh).Sort
        .SetRange Range1
        .Header = xlGuess
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    I use the routine repeatedly in a single Sub to sort on both rows and columns depending on what sheet I am sorting. I would like to replace "xlTopToBottom" with a variable, so that, where appropriate, I can set the orientation variable to 1 or to "xlLeftToRight". This doesn't seem to work. Can it be done?

    Thanks.
    Last edited by Aussiebear; 04-05-2025 at 01:31 AM.

Tags for this Thread

Posting Permissions

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