Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox problem
I am trying to use checkboxes that will place one of two values in a cell
based on the checkbox being TRUE/FALSE. The spreadsheet I have created calculates my baseline annual salary. In doing so, I had to list the holidays that the county recognizes. If I work that holiday, then I get paid for 16 hours. Otherwise I get paid for 8 hours. The problem is that the formula is not picking up the ELSE statement. The value placed in the cell is 16, regardless of the checkbox being TRUE or FALSE. The cells involved a E23:E33 (name of holidays) G23:G33 (value of hours worked - 8 or 16) H23:H33 (placement of checkbox) The formula that I created in the macro is: Private Sub CheckBox1_Click() If CheckBox1.Value = True Then Worksheets("Pay-Calc").Cells(23, 7).Value = 16 Else Worksheets("Pay-Calc").Cells(23, 7).Value = 8 End Sub NOTE: 1) The IF statement is on one line in the macro. 2) The appropriate adjustments were made to reference the correct CHECKBOX and CELL - ie CHECKBOX1 - CHECKBOX11 and CELLS(23,7) - CELLS(33,7) Can anyone help me out with this? Thanks, Les |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox problem
If CheckBox1.Value = True Then Worksheets("Sheet1").Cells(23, 7).Value = 16 Else: Worksheets("Sheet1").Cells(23, 7).Value = 8 End If this seems to work for me -- davesexcel ------------------------------------------------------------------------ davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708 View this thread: http://www.excelforum.com/showthread...hreadid=564091 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
problem with checkbox control | Excel Worksheet Functions | |||
userform checkbox problem with controlsource | Excel Programming | |||
Checkbox problem | Excel Programming | |||
Checkbox problem | Excel Programming | |||
Help: weild checkbox problem | Excel Programming |