1

我有一个带有受保护单元格的工作表。有一个“添加行”按钮,我需要一个“删除行”按钮。但是,我只希望用户能够在指定范围内删除该行。

ActiveSheet.Unprotect 密码:=“密码”

如果Range("ProjectList") 内的“选定行”则

     Row.EntireRow.Delete Shift:=xlUp

End If
ActiveSheet.Protect Password:="password"

4

1 回答 1

7

您可以使用 Intersect 来检查:

If Not Application.Intersect(Selection.EntireRow, Range("ProjectList")) Is Nothing Then
   Selection.EntireRow.Delete Shift:=xlUp
End If
于 2011-11-15T04:20:07.417 回答