title: How do I open a worksheet in vba?
body: <p>Hilariously the following code only works if the worksheet is actually selected in the excel window. I really want to finish this macro soon but can't seem to work out how to select a specific worksheet so it is open in excel? Many thanks if someone knows how. I have to use range and so on.</p>
  
  <pre><code>sheet.Range(Cells(firstRow, 2).Address(False, False), Cells(lastRow, 50)).Select
  With Selection
      .Copy
  End With
  sheet.Range(Cells(firstRow, 3).Address(False, False), Cells(lastRow, 51)).Select
  With Selection
      .PasteSpecial xlPasteValuesAndNumberFormats
  End With
  </code></pre>