View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default This should be so simple but it's not working, please help

try

Sub Return_To_Normal()
rows.hidden=false
columns.hidden=false
Rows("5:2002").AutoFit
'specify your range
range("a5:x2002").sort Key1:=Range("B5"), Order1:=xlAscending, _
Key2:=Range("A5") , Order2:=xlAscending, Header:=xlGuess
End Sub


--
Don Guillett
SalesAid Software

"tahrah" wrote in message
oups.com...
I wrote a "simple" macro to return the screen to normal. It will be a
button the user can click after they've run another macro that hides
some rows and columns. This "simple" macro is supposed to unhide the
columns, unhide the rows, and sort back to the original sort. At first
I only had the unhide and sort, but although it was unhiding all the
rows, it still wasn't showing them. So I added the autofit. But it's
not working still. It will unhide the columns and it will unhide the
rows, but the rows are still invisible because they're coming back as
like size 0 or something. The autofit function works manually but it's
NOT working in the macro. Can anyone see anything wrong with this:

Sub Return_To_Normal()
Cells.Select
Selection.EntireRow.Hidden = False
Selection.EntireColumn.Hidden = False
Rows("5:2002").Select
Cells.EntireRow.AutoFit
Selection.sort Key1:=Range("B5"), Order1:=xlAscending,
Key2:=Range("A5") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1,
MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
Range("A5").Select
End Sub