[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Re: How can this code be made more efficient?

Roger Govier

12/14/2006 3:27:00 PM

Hi Dave

No need to do selection, other than for setting where the freeze panes
is to occur

Try
Sub UnhideAll()
'Unhides all rows/columns
'Freezes window at B6

With ActiveSheet
..Rows.Hidden = False
..Columns.Hidden = False
End With
ActiveWindow.FreezePanes = False
Range("B6").Select
ActiveWindow.FreezePanes = True
End Sub

--
Regards

Roger Govier


"Dave F" <DaveF@discussions.microsoft.com> wrote in message
news:EB1B4B86-ABE9-4A45-BDE5-3E5FE780C7A5@microsoft.com...
> 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?
> --
> Brevity is the soul of wit.


1 Answer

DaveF

12/14/2006 4:13:00 PM

0

Thanks to all; this is helpful.
--
Brevity is the soul of wit.


"Roger Govier" wrote:

> Hi Dave
>
> No need to do selection, other than for setting where the freeze panes
> is to occur
>
> Try
> Sub UnhideAll()
> 'Unhides all rows/columns
> 'Freezes window at B6
>
> With ActiveSheet
> ..Rows.Hidden = False
> ..Columns.Hidden = False
> End With
> ActiveWindow.FreezePanes = False
> Range("B6").Select
> ActiveWindow.FreezePanes = True
> End Sub
>
> --
> Regards
>
> Roger Govier
>
>
> "Dave F" <DaveF@discussions.microsoft.com> wrote in message
> news:EB1B4B86-ABE9-4A45-BDE5-3E5FE780C7A5@microsoft.com...
> > 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?
> > --
> > Brevity is the soul of wit.
>
>
>