PC Review


Reply
Thread Tools Rate Thread

auto freeze panes procedure

 
 
PBcorn
Guest
Posts: n/a
 
      28th Oct 2008
attempting to write code to set up a split and freeze panes on several
worksheets, centreing the split on the first cell with a number value ( can
be 0, but not blank, not a date (incl 2004,2005, jan-08 etc). so that the row
and column headers are static outside the split area. Area should look like
this, filled with numeric data:

jan-08 feb-08 mar-08
a b
b b
c d
d d

the problem is that typename, isnumric and isnull all fail to exclude (blank
or date or string) which is what i need to do to find the first cell with
data in it which is where the split is centered.
 
Reply With Quote
 
 
 
 
PBcorn
Guest
Posts: n/a
 
      29th Oct 2008
Thanks but i ended up using:

If Not TypeName(curcell.Value) = "Empty" _
And Not TypeName(curcell.Value) = "String" _
And Not TypeName(curcell.Value) = "Date" _
And Not curcell.Value = 2002 _
And Not curcell.Value = 2003 _
And Not curcell.Value = 2004 _
And Not curcell.Value = 2005 _
And Not curcell.Value = 2006 _
And Not curcell.Value = 2007 _
And Not curcell.Value = 2008 _
And Not curcell.Value = 2009 Then

to exclude all label cells and the blanks above the labels. However i have
now found that some of the sheet's data contains blank cells. Need to modify
logic to only exclude blank cells above the column headers. There are also
some sheets where the macro puts the split in the middle of the data, which i
can't figure out a reason for, as all the data cells are filled with numbers.

"The Code Cage Team" wrote:

>
> Does this do what you need?
>
> Sub split_at_Number()
> Dim MyCell As Range
> For Each MyCell In ActiveSheet.UsedRange
> If MyCell <> "" And IsNumeric(MyCell) Then
> MyCell.Offset(0, 1).Select
> ActiveWindow.FreezePanes = True
> 'With ActiveWindow 'these 4 lines will install a split at the
> frozen cell
> '.SplitColumn = 0
> '.SplitRow = 0
> 'End With
> End If
> Next
>
> End Sub
> *-Post posted before response, posts merged!*-
> There was a small typo in the code!
>
> Sub split_at_Number()
> Dim MyCell As Range
> For Each MyCell In ActiveSheet.UsedRange
> If MyCell <> "" And IsNumeric(MyCell) Then
> MyCell.Offset(0, 1).Select
> ActiveWindow.FreezePanes = True
> 'With ActiveWindow 'these 4 lines will install a split at the frozen
> cell
> '.SplitColumn = 0
> '.SplitRow = 0
> 'End With
> End If
> Next
>
> End Sub
>
>
> --
> The Code Cage Team
>
> Regards,
> The Code Cage Team
> www.thecodecage.com
> ------------------------------------------------------------------------
> The Code Cage Team's Profile: http://www.thecodecage.com/forumz/member.php?userid=2
> View this thread: http://www.thecodecage.com/forumz/showthread.php?t=8033
>
>

 
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
Freeze Panes Dave Microsoft Access 1 26th May 2009 01:45 PM
RE: Freeze 2 Panes John C Microsoft Excel Misc 5 16th Apr 2009 08:36 PM
Excel 2003 freeze panes won't freeze top row only =?Utf-8?B?bWFjYm9uZTIwMDI=?= Microsoft Excel Misc 1 31st May 2006 04:01 PM
freeze 2 panes help please *k* Microsoft Excel New Users 7 11th Jun 2004 07:38 PM
Freeze Panes P. J. Microsoft Excel Misc 0 19th Sep 2003 05:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:35 PM.