PC Review


Reply
Thread Tools Rate Thread

how do I freeze the window with VBA?

 
 
=?Utf-8?B?RGF2ZSBG?=
Guest
Posts: n/a
 
      17th Nov 2006

--
Brevity is the soul of wit.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?cGdjaG9w?=
Guest
Posts: n/a
 
      17th Nov 2006
Application.ScreenUpdating = False
is what you are looking for ?

"Dave F" wrote:

>
> --
> Brevity is the soul of wit.

 
Reply With Quote
 
=?Utf-8?B?RGF2ZSBG?=
Guest
Posts: n/a
 
      17th Nov 2006
Sorry, let me be a little more specific. I recorded a macro, which I
intended to do the following three things:

1) Hide rows 86:120
2) Hide columns AM:CP
3) Freeze the windo at cell J4

This resulted in the following code:

Sub ShowTCAPSfcst()
'
' ShowTCAPSfcst Macro
' Macro recorded 11/17/2006 by df78700
'

' Hides rows 85:120, hides columns AM:CP, and freezes window at J4
Rows("85:120").Select
Selection.EntireRow.Hidden = True
Columns("AM:CP").Select
Selection.EntireColumn.Hidden = True
Range("J4").Select
ActiveWindow.FreezePanes = True
End Sub

I attached this code to a button and started to test it. I noticed that the
frozen cell wouldn't stay at J4. So, is there better code to use, than that
provided by Excel's default macro recorder?

Thanks,

Dave
--
Brevity is the soul of wit.


"pgchop" wrote:

> Application.ScreenUpdating = False
> is what you are looking for ?
>
> "Dave F" wrote:
>
> >
> > --
> > Brevity is the soul of wit.

 
Reply With Quote
 
=?Utf-8?B?cGdjaG9w?=
Guest
Posts: n/a
 
      17th Nov 2006
ok.
maybe the first question sould be why do you want to hide these columns.
Because you can easily make your calculations on an other sheet and hide the
entire sheet, even with a passord and even "veryhide" the sheet so that the
sheet can not be "unhidden" manually but only using vba...

Sub VeryHideSheet()
Sheets("secret").Visible = xlSheetVeryHidden
End Sub

Sub ShowSheet()
Sheets("secret").Visible = xlSheetVisible
End Sub



"Dave F" wrote:

> Sorry, let me be a little more specific. I recorded a macro, which I
> intended to do the following three things:
>
> 1) Hide rows 86:120
> 2) Hide columns AM:CP
> 3) Freeze the windo at cell J4
>
> This resulted in the following code:
>
> Sub ShowTCAPSfcst()
> '
> ' ShowTCAPSfcst Macro
> ' Macro recorded 11/17/2006 by df78700
> '
>
> ' Hides rows 85:120, hides columns AM:CP, and freezes window at J4
> Rows("85:120").Select
> Selection.EntireRow.Hidden = True
> Columns("AM:CP").Select
> Selection.EntireColumn.Hidden = True
> Range("J4").Select
> ActiveWindow.FreezePanes = True
> End Sub
>
> I attached this code to a button and started to test it. I noticed that the
> frozen cell wouldn't stay at J4. So, is there better code to use, than that
> provided by Excel's default macro recorder?
>
> Thanks,
>
> Dave
> --
> Brevity is the soul of wit.
>
>
> "pgchop" wrote:
>
> > Application.ScreenUpdating = False
> > is what you are looking for ?
> >
> > "Dave F" wrote:
> >
> > >
> > > --
> > > Brevity is the soul of wit.

 
Reply With Quote
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      17th Nov 2006
One issue you might be running up against is that freeze panes must be
removed before they can be reapplied at a new location... Try this...

Sub ShowTCAPSfcst()
'
' ShowTCAPSfcst Macro
' Macro recorded 11/17/2006 by df78700
'

' Hides rows 85:120, hides columns AM:CP, and freezes window at J4
Rows("85:120.EntireRow.Hidden = True
Columns("AM:CP").EntireColumn.Hidden = True
Range("J4").Select
ActiveWindow.FreezePanes = False
ActiveWindow.FreezePanes = True
End Sub

--
HTH...

Jim Thomlinson


"Dave F" wrote:

>
> --
> Brevity is the soul of wit.

 
Reply With Quote
 
=?Utf-8?B?RGF2ZSBG?=
Guest
Posts: n/a
 
      17th Nov 2006
Great, thanks.
--
Brevity is the soul of wit.


"Jim Thomlinson" wrote:

> One issue you might be running up against is that freeze panes must be
> removed before they can be reapplied at a new location... Try this...
>
> Sub ShowTCAPSfcst()
> '
> ' ShowTCAPSfcst Macro
> ' Macro recorded 11/17/2006 by df78700
> '
>
> ' Hides rows 85:120, hides columns AM:CP, and freezes window at J4
> Rows("85:120.EntireRow.Hidden = True
> Columns("AM:CP").EntireColumn.Hidden = True
> Range("J4").Select
> ActiveWindow.FreezePanes = False
> ActiveWindow.FreezePanes = True
> End Sub
>
> --
> HTH...
>
> Jim Thomlinson
>
>
> "Dave F" wrote:
>
> >
> > --
> > Brevity is the soul of wit.

 
Reply With Quote
 
=?Utf-8?B?RGF2ZSBG?=
Guest
Posts: n/a
 
      17th Nov 2006
These rows/columns need to be hidden because this workbook is being sent to a
novice user of Excel who is apparently confused by extraneous data. Hiding
the sheet is irrelevant here. Only a portion of it needs to be hidden.

Dave
--
Brevity is the soul of wit.


"pgchop" wrote:

> ok.
> maybe the first question sould be why do you want to hide these columns.
> Because you can easily make your calculations on an other sheet and hide the
> entire sheet, even with a passord and even "veryhide" the sheet so that the
> sheet can not be "unhidden" manually but only using vba...
>
> Sub VeryHideSheet()
> Sheets("secret").Visible = xlSheetVeryHidden
> End Sub
>
> Sub ShowSheet()
> Sheets("secret").Visible = xlSheetVisible
> End Sub
>
>
>
> "Dave F" wrote:
>
> > Sorry, let me be a little more specific. I recorded a macro, which I
> > intended to do the following three things:
> >
> > 1) Hide rows 86:120
> > 2) Hide columns AM:CP
> > 3) Freeze the windo at cell J4
> >
> > This resulted in the following code:
> >
> > Sub ShowTCAPSfcst()
> > '
> > ' ShowTCAPSfcst Macro
> > ' Macro recorded 11/17/2006 by df78700
> > '
> >
> > ' Hides rows 85:120, hides columns AM:CP, and freezes window at J4
> > Rows("85:120").Select
> > Selection.EntireRow.Hidden = True
> > Columns("AM:CP").Select
> > Selection.EntireColumn.Hidden = True
> > Range("J4").Select
> > ActiveWindow.FreezePanes = True
> > End Sub
> >
> > I attached this code to a button and started to test it. I noticed that the
> > frozen cell wouldn't stay at J4. So, is there better code to use, than that
> > provided by Excel's default macro recorder?
> >
> > Thanks,
> >
> > Dave
> > --
> > Brevity is the soul of wit.
> >
> >
> > "pgchop" wrote:
> >
> > > Application.ScreenUpdating = False
> > > is what you are looking for ?
> > >
> > > "Dave F" wrote:
> > >
> > > >
> > > > --
> > > > Brevity is the soul of wit.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Window Freeze Ronbo Microsoft Excel Programming 2 14th Jul 2008 10:17 AM
Window Freeze =?Utf-8?B?Sm9obiBILg==?= Windows XP Basics 6 1st Jul 2007 04:46 AM
Window Freeze =?Utf-8?B?RGV2?= Windows Vista General Discussion 1 5th Mar 2007 06:51 PM
window freeze ScotD Windows XP General 1 8th Nov 2003 07:40 PM
New Window Freeze BLake Windows XP Internet Explorer 0 28th Sep 2003 08:57 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:04 PM.