ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   assigning value to option button (https://www.excelbanter.com/excel-programming/357931-assigning-value-option-button.html)

Patrick Simonds

assigning value to option button
 
Why is it that this will not set OptionButton1 to true? rng has been
defined and set rng = Cells(ActiveCell.Row, 1). pto is what is in the
referenced cell.

If rng(1, 8).Value = "pto" Then
OptionButton1.Value = True



Tom Ogilvy

assigning value to option button
 
for an optionbutton on the worksheet

? Activesheet.optionbutton1.value
False
Activesheet.optionbutton1.Value = True
? Activesheet.optionbutton1.value
True

on a userform

Private Sub UserForm_Initialize()
OptionButton1.Value = True
End Sub

both worked for me.

Perhaps the IF is not being satisfied.

--
regards,
Tom Ogilvy


"Patrick Simonds" wrote in message
...
Why is it that this will not set OptionButton1 to true? rng has been
defined and set rng = Cells(ActiveCell.Row, 1). pto is what is in the
referenced cell.

If rng(1, 8).Value = "pto" Then
OptionButton1.Value = True





Patrick Simonds

assigning value to option button
 
Sorry this is on a userform. I only want OptionBoutton1 to be true if the
value in the rng equals pto (If rng(1, 8).Value = "pto")




"Tom Ogilvy" wrote in message
...
for an optionbutton on the worksheet

? Activesheet.optionbutton1.value
False
Activesheet.optionbutton1.Value = True
? Activesheet.optionbutton1.value
True

on a userform

Private Sub UserForm_Initialize()
OptionButton1.Value = True
End Sub

both worked for me.

Perhaps the IF is not being satisfied.

--
regards,
Tom Ogilvy


"Patrick Simonds" wrote in message
...
Why is it that this will not set OptionButton1 to true? rng has been
defined and set rng = Cells(ActiveCell.Row, 1). pto is what is in the
referenced cell.

If rng(1, 8).Value = "pto" Then
OptionButton1.Value = True








All times are GMT +1. The time now is 11:53 PM.

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