Delete Line Macro - IF Function
Hi,
I'm trying to create a macro that deletes a line from a spreadsheet i am
developing. The code is below, its works fine but I would like to specify
rows that the macro will not delete.
I need to know the code that specifies either - to end the macro if a
specific row is chosen for deletion. Or even better would be the code that
specifies that the macro will only delete a line within a specific named
range.
Application.ScreenUpdating = False
ActiveSheet.Unprotect "gpro"
varAnswer = MsgBox("Delete Line?", vbOKCancel, "Please Confirm")
If varAnswer = 1 Then
If Range("D17") = "2" Then
ActiveCell.EntireRow.Select
Selection.Delete Shift:=xlUp
Rows("180:180").Select
Selection.EntireRow.Hidden = True
Range("E13").Select
Else
End If
Else: End
End If
ActiveSheet.Protect "gpro", DrawingObjects:=True, Contents:=True,
Scenarios:=True
End help would be great.
Phil
|