Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Sorting Problems

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    24
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I am currently using the following code to sort data in a spreadsheet. Numbers appear in these cells if certain criteria is met in the spreadsheet (i.e. 1 for E1, 2 for E2, and nothing if the criteria is met).

    Worksheets("Sheet1").Range("E1:E11").Sort _
    Key1:=Worksheets("Sheet1").Range("E1")

    This data is always being sorted using code from Userforms to determine what data needs to be incorporated in other userforms. The code works fine until I protect the sheet. For some reason it locks cells E1 to E11. I have tried to unlock the cells via code before and after the sorting, but it still is unable to sort. Any ideas?

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Don't ask me why, but for some reason. You need to have an active cell to perform some of this stuff via code.
    If removing protection does not solve your problem and you are getting a Method of Range type error then add this at the beginning of your code
    sheet1.range("A1").select
    or any other cell for that matter.
    Make sure it is selectable.
    Tom

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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