+ Reply to Thread
Results 1 to 4 of 4

Freeze pane

  1. #1
    Nick London
    Guest

    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("Berkning").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. #2
    Stefi
    Guest

    RE: 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. #3
    Nick London
    Guest

    RE: 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. #4
    Stefi
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1