![]() |
Setting Default of Checkbox based on value of combobox
I have a combobox that is a drop-down menu on one userform. Anothe userform on the sheet is made up only of checkboxes. I want the defaul for one of the checkboxes to be determined by the combobox. If on option, "RCP", is selected, I want the checkbox default to be true. I any of the other options are selected for the combobox, I want th default to be false. Here's the code I was using: Range("h17").Select 'H17 is where the combobox results ar displayed If ActiveCell.Value = rcp Then cbx3099 = True Else: cbx3099 = False End If I have this in the initialize sub for the checkbox userform. I trie putting RCP in quotes, but it made no difference. Thanks -- Lost ----------------------------------------------------------------------- Lost!'s Profile: http://www.excelforum.com/member.php...fo&userid=2399 View this thread: http://www.excelforum.com/showthread.php?threadid=37780 |
Setting Default of Checkbox based on value of combobox
-- When you lose your mind, you free your life. "Lost!" wrote: I have a combobox that is a drop-down menu on one userform. Another userform on the sheet is made up only of checkboxes. I want the default for one of the checkboxes to be determined by the combobox. If one option, "RCP", is selected, I want the checkbox default to be true. If any of the other options are selected for the combobox, I want the default to be false. Here's the code I was using: Range("h17").Select 'H17 is where the combobox results are displayed If ActiveCell.Value = rcp Then cbx3099 = True Else: cbx3099 = False End If I have this in the initialize sub for the checkbox userform. I tried putting RCP in quotes, but it made no difference. Thanks! -- Lost! ------------------------------------------------------------------------ Lost!'s Profile: http://www.excelforum.com/member.php...o&userid=23990 View this thread: http://www.excelforum.com/showthread...hreadid=377808 A couple of points, FIrst where is this code at? is it in a Regular module or in an object module? (Sheet1 Sheet2 ThisWorkbook, etc...) If in a regular Module you must tell VBA where to find the check box also capitolize rcp use the following Range("h17").Select 'H17 is where the combobox results are displayed If ActiveCell.Value = "RCP" Then sheet1.cbx3099 = True Else: sheet1.cbx3099 = False End If if the checkbox is on a different sheet use the correct sheet number for instance sheet2.cbx3099 sheet3.cbx3099 |
All times are GMT +1. The time now is 04:40 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com