문제

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"

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top