title: Specifying sheet to freeze panein excel
body: <p>I am trying to freeze panes using code in excel. i have seen several examples on how to do it with the activewindow, im trying to </p>
  
  <p>sepcify it from a button on a different sheet.</p>
  
  <p>I have 2 sheets, "Time" and "Time_and_Cost", i have a button on the "Time" sheet which i want to freeze the top row of </p>
  
  <p>"Time_and_cost".</p>
  
  <p>I have this code currently for freezing panes of the active window.</p>
  
  <pre><code>Rows("1:1").Select
  ActiveWindow.FreezePanes = True
  </code></pre>
  
  <p>However, how can i adapt this to specify the worksheet, i assume i have to select the worksheet to freeze, freeze it, then </p>
  
  <p>select previous worksheet? im having trouble find the exact code to use.</p>
  
  <p>Thanks in advance</p>