Checkbox problem

G

Guest

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 are:
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
 
D

davesexcel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top