+ Reply to Thread
Results 1 to 2 of 2

Macro Sort Problem

  1. #1
    Hawkfan757
    Guest

    Macro Sort Problem

    I have the following macro that is not working:

    ActiveSheet.Unprotect Password:="test"
    Range("B3:D52").Select
    Selection.Sort Key1:=Range("B3"), Order1:=xlAscending, Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    DataOption1:=xlSortNormal
    Range("A1").Select
    ActiveSheet.Protect Password:="test"

    My problem is that this macro works perfectly fine for me, however, when I
    e-mail it to one of our subsidiary companies to use they get a run time error
    and it asks them to debug. When they debug, it highlights the line beginning
    with: Selection.Sort Key1:=Range("B3"). Any help on fixing this issue would
    be greatly appreciated as I am lost. Thanks.

  2. #2
    RB Smissaert
    Guest

    Re: Macro Sort Problem

    If I remember well, some older versions of Excel can't do this bit:
    DataOption1:=xlSortNormal
    Just leave it off, so you will get:

    ActiveSheet.Unprotect Password:="test"
    Range("B3:D52").Select
    Selection.Sort Key1:=Range("B3"), Order1:=xlAscending, Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    Range("A1").Select
    ActiveSheet.Protect Password:="test"

    RBS


    "Hawkfan757" <[email protected]> wrote in message
    news:[email protected]...
    >I have the following macro that is not working:
    >
    > ActiveSheet.Unprotect Password:="test"
    > Range("B3:D52").Select
    > Selection.Sort Key1:=Range("B3"), Order1:=xlAscending, Header:=xlGuess,
    > _
    > OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    > DataOption1:=xlSortNormal
    > Range("A1").Select
    > ActiveSheet.Protect Password:="test"
    >
    > My problem is that this macro works perfectly fine for me, however, when I
    > e-mail it to one of our subsidiary companies to use they get a run time
    > error
    > and it asks them to debug. When they debug, it highlights the line
    > beginning
    > with: Selection.Sort Key1:=Range("B3"). Any help on fixing this issue
    > would
    > be greatly appreciated as I am lost. Thanks.



+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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