ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   if function prob (https://www.excelbanter.com/excel-programming/296067-if-function-prob.html)

Manisha[_2_]

if function prob
 
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

DSC[_5_]

if function prob
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

if function prob
 
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)

"Manisha" wrote in message
...
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





All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com