Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How can this code be made more efficient?
On Dec 14, 3:10 pm, Dave F wrote: Sub UnhideAll() 'Unhides all rows/columns 'Freezes window at B6 Cells.Select Range("B1").Activate Selection.EntireRow.Hidden = False Selection.EntireColumn.Hidden = False Range("B6").Select ActiveWindow.FreezePanes = False ActiveWindow.FreezePanes = True End Sub This was recorded via the macro recorder and then slightly modified by me. My understanding is that the recorder does not create the most efficient code, but I don't know what's inefficient about this code. Any advice? If it does what you want and does it fast enough then I wouldn't worry about it. If you're dead set on cleaning up the code, then the sequence of Activate, then Select followed by using the Selection object can be compressed. I suppose you might get to something like this, which (from a very quick test) seems to do the same as your recorded code: Sub UnhideAll() 'Unhides all rows/columns 'Freezes window at B6 With Cells .EntireRow.Hidden = False .EntireColumn.Hidden = False End With Range("B6").Select With ActiveWindow .FreezePanes = False .FreezePanes = True End With End Sub HTH, Mike |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can this code be made more efficient? | Excel Programming | |||
Efficient Code | Excel Programming | |||
More Efficient code than this | Excel Programming | |||
Can this procedure be made more efficient? | Excel Programming | |||
More efficient code | Excel Programming |