1

I have a worksheet with protected cells. There's an 'add row' button and I need a 'delete row' button. HOWEVER, I only want the user to be able to delete the row if it is within a named range.

ActiveSheet.Unprotect Password:="password"

If "selected row" within Range("ProjectList") Then

     Row.EntireRow.Delete Shift:=xlUp

End If
ActiveSheet.Protect Password:="password"

Adam Rackis
  • 82,527
  • 56
  • 270
  • 393
Steamroller60
  • 25
  • 1
  • 6

1 Answers1

7

You can use Intersect to check this:

If Not Application.Intersect(Selection.EntireRow, Range("ProjectList")) Is Nothing Then
   Selection.EntireRow.Delete Shift:=xlUp
End If
Tim Williams
  • 154,628
  • 8
  • 97
  • 125