Question

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"

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top