Results 1 to 2 of 2

Thread: Excel VBA Macro To Freeze Panes Without Activating WorkSheet

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    7
    Rep Power
    0

    Excel VBA Macro To Freeze Panes Without Activating WorkSheet

    I want to freeze panes but dont want to activate sheet i.e. in common i use activewindow.freezepanes method but that require sheet to be activated.
    any alternate to that??

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=bRd4mJglWiM&lc=UgxRmh2gFhpmHNnPemR4AaABAg. A0opm95t2XEA0q3KshmuuY
    https://www.youtube.com/watch?v=bRd4mJglWiM&lc=UgxRmh2gFhpmHNnPemR4AaABAg
    https://eileenslounge.com/viewtopic.php?p=318868#p318868
    https://eileenslounge.com/viewtopic.php?p=318311#p318311
    https://eileenslounge.com/viewtopic.php?p=318302#p318302
    https://eileenslounge.com/viewtopic.php?p=317704#p317704
    https://eileenslounge.com/viewtopic.php?p=317704#p317704
    https://eileenslounge.com/viewtopic.php?p=317857#p317857
    https://eileenslounge.com/viewtopic.php?p=317541#p317541
    https://eileenslounge.com/viewtopic.php?p=317520#p317520
    https://eileenslounge.com/viewtopic.php?p=317510#p317510
    https://eileenslounge.com/viewtopic.php?p=317547#p317547
    https://eileenslounge.com/viewtopic.php?p=317573#p317573
    https://eileenslounge.com/viewtopic.php?p=317574#p317574
    https://eileenslounge.com/viewtopic.php?p=317582#p317582
    https://eileenslounge.com/viewtopic.php?p=317583#p317583
    https://eileenslounge.com/viewtopic.php?p=317605#p317605
    https://eileenslounge.com/viewtopic.php?p=316935#p316935
    https://eileenslounge.com/viewtopic.php?p=317030#p317030
    https://eileenslounge.com/viewtopic.php?p=317030#p317030
    https://eileenslounge.com/viewtopic.php?p=317014#p317014
    https://eileenslounge.com/viewtopic.php?p=316940#p316940
    https://eileenslounge.com/viewtopic.php?p=316927#p316927
    https://eileenslounge.com/viewtopic.php?p=316875#p316875
    https://eileenslounge.com/viewtopic.php?p=316704#p316704
    https://eileenslounge.com/viewtopic.php?p=316412#p316412
    https://eileenslounge.com/viewtopic.php?p=316412#p316412
    https://eileenslounge.com/viewtopic.php?p=316254#p316254
    https://eileenslounge.com/viewtopic.php?p=316046#p316046
    https://eileenslounge.com/viewtopic.php?p=317050&sid=d7e077e50e904a138c794e1 f2115da95#p317050
    https://www.youtube.com/@alanelston2330
    https://www.youtube.com/watch?v=yXaYszT11CA&lc=UgxEjo0Di9-9cnl8UnZ4AaABAg.9XYLEH1OwDIA35HNIei0z-
    https://eileenslounge.com/viewtopic.php?p=316154#p316154
    https://www.youtube.com/watch?v=TW3l7PkSPD4&lc=UgwAL_Jrv7yg7WWC8x14AaABAg
    https://teylyn.com/2017/03/21/dollarsigns/#comment-191
    https://eileenslounge.com/viewtopic.php?p=317050#p317050
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 07-28-2024 at 02:18 PM.

  2. #2
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    13
    Quote Originally Posted by SP69 View Post
    I want to freeze panes but dont want to activate sheet i.e. in common i use activewindow.freezepanes method but that require sheet to be activated.
    any alternate to that??
    I do not know of any other way to do it, but that doesn't mean you have to leave it as the active sheet nor let the user see it become active. Consider this structure for your code...
    Code:
    Sub FreezePanesOnAnotherSheet()
      Dim CurrentSheet As Worksheet, SheetToFreeze As Worksheet, CellToFreezeAt As String
      ' Store the current sheet so we can go back to it
      Set CurrentSheet = ActiveSheet
      ' Set a reference to the sheet that will have its panes frozen
      Set SheetToFreeze = Worksheets("Sheet2")
      ' Set the address of the cell that will be used to freeze the panes at
      CellToFreezeAt = "C3"
      ' Do not let the user see what is happening
      Application.ScreenUpdating = False
      ' Go to sheet that is to be frozen
      SheetToFreeze.Select
      ' Activate the cell to freeze at
      Range(CellToFreezeAt).Select
      ' Freeze the sheet
      ActiveWindow.FreezePanes = True
      ' Go back to the original sheet
      CurrentSheet.Select
      ' Let the user see again
      Application.ScreenUpdating = True
    End Sub

Similar Threads

  1. Replies: 4
    Last Post: 07-02-2013, 11:32 AM
  2. SQL output from Excel VBA macro
    By goldenbutter in forum Excel Help
    Replies: 3
    Last Post: 05-07-2013, 08:07 PM
  3. Print Nth Worksheet To Mth Worksheet using VBA
    By Ryan_Bernal in forum Excel Help
    Replies: 2
    Last Post: 02-28-2013, 06:57 PM
  4. Excel 2007 - Freeze Pane without lines
    By irshath in forum Excel Help
    Replies: 1
    Last Post: 02-23-2013, 11:27 PM
  5. Replies: 4
    Last Post: 08-14-2012, 03:17 AM

Tags for this Thread

Posting Permissions

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