I'm using the Macro recorder in an attempt to learn more, but need help. I'm trying to create/clear a drop down list based upon a cell's selection (from a separate list).
In cell C2 (a list), if "Hourly Rate" is selected a data validation list should populate C3, otherwise C3 should clear contents....making it a normal cell.
How do you add if C2=hourly rate then add drop down otherwise clear contents?
In cell C2 (a list), if "Hourly Rate" is selected a data validation list should populate C3, otherwise C3 should clear contents....making it a normal cell.
How do you add if C2=hourly rate then add drop down otherwise clear contents?
VBA Code:
Sub testDropDown()
'
' testDropDown Macro
'
'
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$N$17:$N$26"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = False
.ShowError = True
End With
End Sub
Sub testdeletedropdown()
'
' testdeletedropdown Macro
'
'
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = False
.ShowError = True
End With
Selection.ClearContents
End Sub