ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checkbox problem (https://www.excelbanter.com/excel-programming/341408-checkbox-problem.html)

Patrick Simonds

Checkbox problem
 
Not sure why the following code returns an Object Required Error:

If CheckBox1.Value = True Then
rng(1, 6) = "Exempt"
End If

What I want to have happen is for the word Exempt to be placed in the rng(1,
6) when there is a check in Checkbox1



Norman Jones

Checkbox problem
 
Hi Patrick,

If the checkbox is from the Contol Toolbox,

Try:

If ActiveSheet.OLEObjects("CheckBox1").Object.Value = True Then
Cells(1, 6).Value = "Exempt"
'Or, if rng has been set to a range:
rng(1, 6).Value = "Exempt"
End If


If the checkbox is from the Forms Toolbar, try something like:

If ActiveSheet.CheckBoxes("Check Box 2").Value = xlOn Then
Cells(1, 6).Value = "Exempt"
'Or, if rng has been set to a range:
rng(1, 6).Value = "Exempt"
End If

---
Regards,
Norman



"Patrick Simonds" wrote in message
...
Not sure why the following code returns an Object Required Error:

If CheckBox1.Value = True Then
rng(1, 6) = "Exempt"
End If

What I want to have happen is for the word Exempt to be placed in the
rng(1,
6) when there is a check in Checkbox1





All times are GMT +1. The time now is 05:23 PM.

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