I have the following command buttons in a sheet. he problem is that when I use the CommandButton2 Clear col A and B function the formulas in the cells of Col d- h are cleared as well. Any suggestions?
Private Sub CommandButton1_Click()
ActiveSheet.Unprotect "Passwordgoeshere"
'Toggle rows hidden where cells in column D are blank
If ActiveSheet.AutoFilterMode Then
ActiveSheet.AutoFilterMode = False
Else
Range("D3:D1000").AutoFilter Field:=1, Criteria1:="<>", VisibleDropDown:=False
End If
ActiveSheet.Protect "Passwordgoeshere"
End Sub
Private Sub CommandButton2_Click()
ActiveSheet.Unprotect "Passwordgoeshere"
Range("A3:B1000").ClearContents
ActiveSheet.Protect "Passwordgoeshere"
End Sub
Private Sub CommandButton1_Click()
ActiveSheet.Unprotect "Passwordgoeshere"
'Toggle rows hidden where cells in column D are blank
If ActiveSheet.AutoFilterMode Then
ActiveSheet.AutoFilterMode = False
Else
Range("D3:D1000").AutoFilter Field:=1, Criteria1:="<>", VisibleDropDown:=False
End If
ActiveSheet.Protect "Passwordgoeshere"
End Sub
Private Sub CommandButton2_Click()
ActiveSheet.Unprotect "Passwordgoeshere"
Range("A3:B1000").ClearContents
ActiveSheet.Protect "Passwordgoeshere"
End Sub