if function prob

  • Thread starter Thread starter Manisha
  • Start date Start date
M

Manisha

i hav a userfrom, on this 2 button.
to 1 of these i want to attach an IF statement sayin if
this button is pressed enter data onto 2nd line in the
spreadsheet. does ne1 kno the correct terminology??

thanks
 
To do this all you need to do is to look at the correct event Handler
of the Buttons

from your Userform select view code then

Select your first button name from the drop down list
and click should be autoselected

then you could add code in the subroutine like this

Private Sub cmdButton1_Click()
Worksheets("Sheet1").Range("A2").Value = "Button1"
End Sub

repeat as needed

Hope this Helps

Davi
 
You don't need an if as the button has a click event which is effectively
telling your code that it has been clicked.

Private Sub CommandButton1_Click()
Msgbox "Button1 clicked"
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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