#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Freeze pane

I have a macro in which I want to freeze panes. The problem is that I do not
know how to write it variably. I want to freeze panes in the column where I
find a certain word. The code is:

Set rng2 = Worksheets("Beräkning").Cells.Find("Security ID", LookIn:=xlValues)
......
Columns(rng2.Address).Select
ActiveWindow.FreezePanes = True

The penultimate line is wrong but I do not know how write it. Please help me
out!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Freeze pane

Hi Nick,

If you want to freeze just before column containing "Security ID" (and no
rows at all):

freezecol = Worksheets("Beräkning").Cells.Find("Security ID",
LookIn:=xlValues).Column
' .....
Cells(1, freezecol).Select
ActiveWindow.FreezePanes = True

Regards,
Stefi

Nick London ezt *rta:

I have a macro in which I want to freeze panes. The problem is that I do not
know how to write it variably. I want to freeze panes in the column where I
find a certain word. The code is:

Set rng2 = Worksheets("Beräkning").Cells.Find("Security ID", LookIn:=xlValues)
.....
Columns(rng2.Address).Select
ActiveWindow.FreezePanes = True

The penultimate line is wrong but I do not know how write it. Please help me
out!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Freeze pane

Thanks, it lokks like a good code but I cannot get it to work. I wrote the
code like:

Dim freezecol As Range
Set freezecol = Worksheets("Beräkning").Cells.Find("Security ID",
LookIn:=xlValues).Column
Cells(1, freezecol).Select
ActiveWindow.FreezePanes = True

But if I write that code the program just stops and does not run anymore
code. No error message is given. Do you have any idea? Thanks!


"Stefi" skrev:

Hi Nick,

If you want to freeze just before column containing "Security ID" (and no
rows at all):

freezecol = Worksheets("Beräkning").Cells.Find("Security ID",
LookIn:=xlValues).Column
' .....
Cells(1, freezecol).Select
ActiveWindow.FreezePanes = True

Regards,
Stefi

Nick London ezt *rta:

I have a macro in which I want to freeze panes. The problem is that I do not
know how to write it variably. I want to freeze panes in the column where I
find a certain word. The code is:

Set rng2 = Worksheets("Beräkning").Cells.Find("Security ID", LookIn:=xlValues)
.....
Columns(rng2.Address).Select
ActiveWindow.FreezePanes = True

The penultimate line is wrong but I do not know how write it. Please help me
out!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Freeze pane

Hi Nick,

freezecol is Not a Range but a Long standing for column number: 1 for column
A, 2 for column B, etc.
Cells(1, freezecol) refers to the cell at intersection of row 1 and column
"freezecol".

Leave the code as it was and it will work.

Regards,
Stefi


Nick London ezt *rta:

Thanks, it lokks like a good code but I cannot get it to work. I wrote the
code like:

Dim freezecol As Range
Set freezecol = Worksheets("Beräkning").Cells.Find("Security ID",
LookIn:=xlValues).Column
Cells(1, freezecol).Select
ActiveWindow.FreezePanes = True

But if I write that code the program just stops and does not run anymore
code. No error message is given. Do you have any idea? Thanks!


"Stefi" skrev:

Hi Nick,

If you want to freeze just before column containing "Security ID" (and no
rows at all):

freezecol = Worksheets("Beräkning").Cells.Find("Security ID",
LookIn:=xlValues).Column
' .....
Cells(1, freezecol).Select
ActiveWindow.FreezePanes = True

Regards,
Stefi

Nick London ezt *rta:

I have a macro in which I want to freeze panes. The problem is that I do not
know how to write it variably. I want to freeze panes in the column where I
find a certain word. The code is:

Set rng2 = Worksheets("Beräkning").Cells.Find("Security ID", LookIn:=xlValues)
.....
Columns(rng2.Address).Select
ActiveWindow.FreezePanes = True

The penultimate line is wrong but I do not know how write it. Please help me
out!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
FREEZE PANE Freeze Pane Excel Discussion (Misc queries) 2 April 9th 09 02:53 AM
freeze pane Atishoo Excel Discussion (Misc queries) 3 July 11th 08 08:33 PM
freeze pane: freeze from two worksheets? Chris Excel Discussion (Misc queries) 4 May 27th 08 01:17 AM
freeze pane for more than one row anyone??? Angela1 Excel Discussion (Misc queries) 4 September 24th 07 03:06 AM
Freeze pane Joe Excel Programming 2 August 2nd 04 01:27 PM


All times are GMT +1. The time now is 03:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"