Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I seem to have a "unique" problem. I have researched many differen sites about VBA and macros, etc. ... but, none have seemed to run int this situation. In short, I recorded a macro to do the following: (1) select a name region, (2) unprotect the worksheet, (3) sort the named region (b last name, then first name), (4) protect the worksheet. Then, I turn right around and run the macro--it does steps (1) and (2 just fine, but pauses on step (3) [Note: sometimes it does (3) the stops, and other times it doesn't even do step (3)] I have looked at the VBA code, and it was the same code that worke with earlier versions of my workbook--believe me, I have re-recorde this same macro many times--the sort works when I record it, but alway pauses (usually before) it does the sort. [In fact, the data sor ALWAYS works when I do it in Excel, but has problems with the VB code.] Even when I use the Debug toolbar to step through the code--i highlights each step in yellow, and then runs it--but when it gets t the sort step, the debugger will not go beyond the sort step. In fact it will attempt running the sort (not always succeeding) and put th cursor before the sort statement. Needless to say, I'm frustrated! Any help will be appreciated! Here is the VBA code, in case it helps: Sub sort_name() Application.Goto Reference:="student.sort" ActiveSheet.Unprotect Selection.Sort Key1:=Range("A4"), Order1:=xlAscending Key2:=Range("B4") _ , Order2:=xlAscending, Header:=xlNo, OrderCustom:=1 MatchCase:=False, _ Orientation:=xlTopToBottom, DataOption1:=xlSortNormal DataOption2:= _ xlSortNormal ActiveSheet.Protect DrawingObjects:=True, Contents:=True Scenarios:=True _ , AllowSorting:=True Range("A1").Select End Su -- Junio ----------------------------------------------------------------------- Junior's Profile: http://www.msusenet.com/member.php?userid=515 View this thread: http://www.msusenet.com/t-187106295 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Recorded macro | Excel Discussion (Misc queries) | |||
Problem with a recorded macro to create two pivot tables from same data | Excel Programming | |||
Problem with a recorded macro to create two pivot tables from same data | Excel Programming | |||
Problem with my Unique Number Macro...Help? | Excel Programming |