Results 1 to 7 of 7

Why DOESN'T this Sort Code work?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    10-02-2008
    Location
    Berkeley, CA
    MS-Off Ver
    Windows 2007
    Posts
    105

    Why DOESN'T this Sort Code work?

    This Code works
    With ActiveWorkbook.Worksheets("Attendance").Sort
            .SetRange Range("A3:J40")
            .Header = xlGuess
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
    End With
    and Code this doesn't work
    Dim SHEET as Worksheet
    Set SHEET = Sheets("NAME")
    SHEET.Activate
    Rng = "3:40"
    
    With SHEET.Sort
            .SetRange Range(Rng)
            .Header = xlGuess
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply                                <--- fails on this line    
    End With
    So what am I missing here? Thanks for any help you can give me.
    Mac
    Last edited by CaptMac; 03-18-2016 at 01:09 PM. Reason: Corrected a line

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Need help with VBA code. Tons of code seperated in two, second part of code doesn't work.
    By FragaGeddon in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 11-30-2015, 11:46 AM
  2. code doesn't work when i change.
    By superchew in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2015, 03:11 PM
  3. [SOLVED] Code in Worksheet_Change doesn't work
    By Rufles in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-25-2014, 06:09 AM
  4. code from Excel Help doesn't work
    By ryan darrow in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2011, 01:17 PM
  5. [SOLVED] why doesn't sort work when it's choosen before protecting sheet
    By Mearll in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-01-2006, 03:35 PM
  6. [SOLVED] Why doesn't ths VBA Code work?
    By Mac Lingo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-23-2005, 10:10 PM
  7. [SOLVED] vba code doesn't work
    By lschuh in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 07-22-2005, 02:05 PM

Tags for this Thread

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