title: How do you get a UserForm to activate on double click of a cell?
body: <p>I haven't been able to get this to work for a long time now after trying a lot of different things I've found online. </p>
  
  <p>I am trying to get a UserForm called "UserComment" to open and activate when I double click a cell (within the columns of B-K and  and rows starting at 2 down to the last row of data) on a sheet called Open_Orders.</p>
  
  <p>This is the code I have pasted into the Open_Orders sheet area (not a module).</p>
  
  <pre><code>Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  
  Dim Lastrow As Integer
  Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
  
  Set rng1 = Open_Orders.Cells(2, 2)
  Set rng2 = Open_Orders.Cells(11 &amp; Lastrow)
  Set NewRng = .Range(rng1, rng2)
  
      If Not Application.Intersect(Target, Range("NewRng")) Is Nothing Then
          Cancel = True
          UserComment.Show
      End If
  End Sub
  </code></pre>
  
  <p>When I click on a cell I get the error "Compile Error: Invalid of unqualified reference" and it highlights in blue the ".Range" section of where I set NewRng. </p>
  
  <p>Any ideas of what I can do to fix this?</p>
  
  <p>Also, this is a protected sheet with a password "maintenance"...not sure why there was no problem there.</p>
  
  <p>EDIT: I have added the following code as the first line of code and I still get the same error:</p>
  
  <pre><code>Open_Orders.Protect Password:="maintenance", UserInterFaceOnly:=True
  </code></pre>
  
  <p>EDIT AGAIN: Gary's Student helped in the comments below by changing Range("NewRng") to to just NewRng....however it still doesn't work because it says its protected EVEN THOUGH I have that code above that should allow it to work.</p>
  
  <p><strong>***UPDATE***</strong>
  For some reason, when I click the first row of data (row 2), it prompts for a password, and if I press cancel, then the correct userform pops up. No idea what is going on.</p>