Hello,
I am trying to write some code that will allow me from a userform to place a validate list option in cell, but default to the first item in that list. I have the following code which seems to work to enable the cell to become a validatelist.
and I am using the following code to automatically select the 1st item, but it fails with an invalid qualifier error.
Thank you for any assistance
Mar050703
I am trying to write some code that will allow me from a userform to place a validate list option in cell, but default to the first item in that list. I have the following code which seems to work to enable the cell to become a validatelist.
Code:
Private Sub CommandButton1_Click()
Dim rCl As Range
With Sheets("Sheet1")
Set rCl = .Cells(.Rows.Count, 1).End(xlUp).Offset(1)
End With
rCl.Value = txtamt
With rCl.Offset(0, 3).Validation
.Add xlValidateList, xlValidAlertStop, xlBetween, "=Name"
.InCellDropdown = True
End With
and I am using the following code to automatically select the 1st item, but it fails with an invalid qualifier error.
Code:
rCl.Value = Replace(ActiveCell.Validation.Formula1, "=", "").Cells(1, 1).Value
Thank you for any assistance
Mar050703