title: Align Userform to cells in Excel
body: <p>I'm attempting to position a userform (named UserForm1) in Excel to align with cell references in Excel. If I initialize the form using the first code below, the userform is correct size positioned in the centre of the screen in Excel.</p>
  <pre><code>Private Sub UserForm_Initialize()
  
  With Me
    .Width = 200
    .Height = 170
  End With
  
  End Sub
  </code></pre>
  <p>However, I want to resize to align the userform so that it covers cells B3:D15. I've tried</p>
  <pre><code>Private Sub UserForm_Initialize()
  
  With Me
  .Top = Sheet1.Range(&quot;B3&quot;).Top
  .Left = Sheet1.Range(&quot;B3&quot;).Left
  .Width = Sheet1.Range(&quot;B3&quot;).Offset(0, 4).Left - Sheet1.Range(&quot;B3&quot;).Left
  .Height = Sheet1.Range(&quot;B3&quot;).Offset(12, 0).Top - Sheet1.Range(&quot;B3&quot;).Top
  End With
  
  End Sub
  </code></pre>
  <p>but the userform appears over the ribbon (Excel zoom is at 100%.)</p>
  <p>Is there a way to do this properly taking into account screen resolution/zoom size?</p>