+ Reply to Thread
Results 1 to 2 of 2

Checkbox problem

Hybrid View

  1. #1
    WLMPilot
    Guest

    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 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

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1