+ Reply to Thread
Results 1 to 6 of 6

Freeze top row in vba

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Freeze top row in vba

    hi, i am trying to freeze the top row of a given worksheet. I recorded a macro to see how to do it and this is what it gives me.

    Please Login or Register  to view this content.

    I replaced the "activewindow" with

    workbooks(fl_name).worksheets(1)

    but it does not work.


    So i used this


    Please Login or Register  to view this content.
    While this did work.........froze top row............but it also split the top row. So i could not simply unfreeze the top row.


    Is there a better way to freeze the top row?
    Last edited by welchs101; 02-17-2012 at 09:12 AM.

  2. #2
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Freeze top row in vba

    i think i found a better way

    Please Login or Register  to view this content.
    i just selected the row below where i wanted to freeze it.

    I would still like to know why i have to use activewindow and why i cant use an assignment like
    "workbooks(jlkjkkljl).worksheet(jlj)" instead of activewindow.......

  3. #3
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Freeze top row in vba

    FreezePanes is a property of the window, not the worksheet.
    Good luck.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,943

    Re: Freeze top row in vba

    Try:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Freeze top row in vba

    Try:

    Please Login or Register  to view this content.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  6. #6
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Freeze top row in vba

    thanks for the info and code.

+ 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