Help with check box

HDfatboy03

Board Regular
Joined
May 23, 2010
Messages
62
Hello

Need help with check boxes. I have the following statement, the check box return's "TRUE" when selected but does not return "FALSE" when NOT selected and I need it turn return "FALSE" when not selected.

Below is the code I am using. What am I missing?

<Start Code>

'START box buttons for FAIRWAYS HIT H E R E
'copy the NEW DATA FAIRWAYS HIT to database
If FH1 = True Then
ws.Cells(iRow, 42).Value = FH1.Value
ws2.Cells(9, "C").Value = FH1.Value
End If

<End Code>

Thanks for any assistance or suggestion

HDfatboy03
 

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,453
How did you create your Checkboxes? Using Forms Toolbar or Active-X toolbox?
 

dave3009

Well-known Member
Joined
Jun 23, 2006
Messages
6,996
Perhaps

Code:
'START box buttons for FAIRWAYS HIT H E R E
'copy the NEW DATA FAIRWAYS HIT to database
Select Case FH1
Case True:  ws.Cells(iRow, 42).Value = FH1.Value
            ws2.Cells(9, "C").Value = FH1.Value
Case False:
End Select
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,166
Take out the IF function...

'START box buttons for FAIRWAYS HIT H E R E
'copy the NEW DATA FAIRWAYS HIT to database
ws.Cells(iRow, 42).Value = FH1.Value
ws2.Cells(9, "C").Value = FH1.Value
 

HDfatboy03

Board Regular
Joined
May 23, 2010
Messages
62
Jim

Thanks for the help ... its working now. Now my formula is not working,

=COUNTA(C10:K10)

I need my formula to COUNT the "TRUE" in that range. Do you have any suggestions?

Thanks for your help

HDfatboy03
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,166
Maybe try...
=COUNTIF(C10:K10, TRUE)

or

=SUM(C10:K10)

assuming all the cells in C10:K10 are true or false (1 or 0)
 

Forum statistics

Threads
1,081,530
Messages
5,359,347
Members
400,524
Latest member
Excelbat

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top