VBA, freeze panes without select

Solved
Anthelm Posted messages 202 Status Member -  
Anthelm Posted messages 202 Status Member -
Hello,

I would like to freeze the panes in my sheet without selecting a cell.
I have 3 columns and 2 rows to freeze, so normally, you would select D3 and do "freeze panes".

I would like to do the same thing without select, so something like:

ActiveWindow.Range("D3").FreezePanes = True

This does not work. Any ideas? Is it possible?

Thank you!

Configuration: Windows / Firefox 63.0

3 answers

  1. Vaucluse Posted messages 27336 Registration date   Status Contributor Last intervention   6 453
     
    Good evening
    try this:

    Range("D3").Select
    ActiveWindow.FreezePanes = True

    crdlmnt

    --
    The quality of the response mostly depends on the clarity of the question, thank you!
    1
    1. Anthelm Posted messages 202 Status Member 1
       
      Good evening again Vaucluse!

      Not quite that, actually :D
      0
  2. Mike-31 Posted messages 18405 Registration date   Status Contributor Last intervention   5 147
     
    Good evening,

    You have to go through a Select
    Excel has not to my knowledge provided this option.

    --
    See you later
    Mike-31

    I am responsible for what I say, not for what you understand...
    1
  3. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
     
    Hello,

    but nothing stops you from memorizing the active cell, setting
    Application.screenupdating=false

    positioning your pane, and restoring the active cell.
    No one will notice anything, just like if you hadn't selected it.
    eric

    --
    By continuously trying, we eventually succeed.
    So the more it fails, the more chances we have for it to work. (the Shadoks)
    In addition to the thank you (yes, it can be done!!!), remember to mark it as resolved. Thank you.
    1
    1. Anthelm Posted messages 202 Status Member 1
       
      Aaaah yes, Vaucluse had already told me about this function but I hadn't thought to use it here! Thank you very much, it should work indeed.
      0