title: Excel VB - Refer to worksheet index using a variable?
body: <p>I would like to use a single line of code to refer to the same cell but in different worksheets (within the same workbook).  For example:</p>
  
  <pre><code>Dim SheetRef as Worksheet
  SheetRef = Sheet6    
  SheetRef.Range("E5").Value = "Please work!"
  </code></pre>
  
  <p>where SheetRef can be changed within VB to represent different worksheet index numbers (rather than sheet name).</p>
  
  <p>I have tried many combinations, dim'd the variable as many different things, googled high and low and made no progress, any assistance very much appreciated!</p>
  
  <p>Many thanks,</p>
  
  <p>Martin.</p>