I have a series of named ranges on a sheet. I want to clear the contents and not the formulas. When I run the below, it clears the named ranges and then clears the entire sheet. Also, if I have no constants, it gives me an error. Help! TIA.
Private Sub CommandButton1_Click()
On Error Resume Next
Range("Inputs_1").Select
Selection.SpecialCells(xlCellTypeConstants).Select
Selection.ClearContents
Range("Inputs_2").Select
Selection.SpecialCells(xlCellTypeConstants).Select
Selection.ClearContents
Range("Inputs_3").Select
Selection.SpecialCells(xlCellTypeConstants).Select
Selection.ClearContents
End Sub
Private Sub CommandButton1_Click()
On Error Resume Next
Range("Inputs_1").Select
Selection.SpecialCells(xlCellTypeConstants).Select
Selection.ClearContents
Range("Inputs_2").Select
Selection.SpecialCells(xlCellTypeConstants).Select
Selection.ClearContents
Range("Inputs_3").Select
Selection.SpecialCells(xlCellTypeConstants).Select
Selection.ClearContents
End Sub