HCBBS Forum (English)
Submit Chemical Projects / Find Solutions
Amplify Your Requirements on a Broader Chemical Platform *Engineering · Technology · Equipment · Solutions*
Submit Request

How do toggle buttons return values in VBA?

2009-02-27View Original

Thread Content

I’m seeking help from experts: The value of a toggle button is only either true or false, but how can I make a number 2 appear in a cell in sheet1 whenever that button is pressed? What code to use?
Reply #22009-02-27
Create a button in EXCEL that links to a macro. By writing the following statement in a macro: sheet1.cells(1,1).value=2, the value 2 will be displayed in cell A1.
Reply #32009-02-28
It seems you’ve created the form yourself; when the toggle button is pressed, a Click event is triggered. The code is as follows: Private Sub ToggleButton1_Click() If ToggleButton1.Value = True Then Sheet1.Cells(1, 1).Value = 2 Else Sheet1.Cells(1, 1).Value = xxxx ‘Enter some other value if it’s FALSE’ End If End Sub
Reply #42009-03-01
Thank you, coolmoonns from above

Submit a Project

**Looking for Chemical Technology, Equipment & Solutions?** No Registration Required Broader Platform Exposure | Global Chemical Service Provider Connections

Submit Request — Free Consultation

Disclaimer

This is an automated machine translation of the original thread. Some technical terms may have inaccuracies; the original text shall prevail. Click "View Original" at the top right to access the source page, which supports IP-based automatic real-time language translation. Please watch out for contact details and sales inducements to prevent fraud. All content and translations are for reference only, representing solely the poster's personal views. For enquiries, email service@hcbbs.com.