ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Display VB code result in cell instead of message box? (https://www.excelbanter.com/excel-programming/428151-re-display-vbulletin-code-result-cell-instead-message-box.html)

Peter T

Display VB code result in cell instead of message box?
 
dim myCBoxes as long
myCBoxes = -1 * (CheckBox1 + CheckBox2 + CheckBox3 + CheckBox4)
Range("A1").value = myCBoxes

Another way without code way would be to assign the linkedCell property of
each checkbox to a cell, lets say A1:A4 respectively, and sum them

=SUM(--(A1:A4)) array entered

or not array entered
=SUMPRODUCT(--(A1:A4))

Regards,
Peter T


"Leigh Douglass" wrote in message
...
Is it possible to get the result of the code below to show in a cell on my
spreadsheet instead of displaying in a message box?

Thanks
Leigh

Private Sub GetResult()
' counter
MsgBox -1 * (CheckBox1 + CheckBox2 + CheckBox3 + CheckBox4)
' binary encoded
MsgBox -1 * (CheckBox1 + CheckBox2 + CheckBox3 + CheckBox4)
End Sub





All times are GMT +1. The time now is 03:02 AM.

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