Help with VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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

=randbetween(1,100)
 
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
'<<=============
 
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
'<<=============
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top