Hello I got some code for selecting the nearest value to the user value that is
Private Sub CommandButton1_Click()
Dim col As Integer
col = Me.TextBox1.Value
ActiveCell.FormulaR1C1 = "=SMALL($A$1:$EN$1,COUNTIF($A$1:$EN$1,""<" & col & """)+1)"
End Sub
But i am getting RUNTIME ERROR 1004
anybody help me please
You invoke the R1C1-style formula property, but supply an A1-style formula. Try this instead:
i.e.
ActiveCell.Formulainstead ofActiveCell.FormulaR1C1.