Help with VBA

  • Thread starter Need help with sumif
  • Start date
N

Need help with sumif

I would like to use a command button for this excel formula

=randbetween(1,100)
 
N

Norman Jones

Hi,
I would like to use a command button for this excel formula
=randbetween(1,100)


Try:

'=============>>
Private Sub CommandButton1_Click()
Selection.Formula = "=RandBetween(1,100)"
End Sub
'<<=============
 
N

Norman Jones

Hi Need help with sumif,
I'm sorry what I meant was Cells(3,3) = randbetween(1,100)

Try:

'=============>>
Private Sub CommandButton1_Click()
Me.Cells(3,3).Formula = "=RandBetween(1,100)"
End Sub
'<<=============
 
Top