Check box macros

  • Thread starter Thread starter Sunlover
  • Start date Start date
S

Sunlover

Hi there,

On a form if a checkbox is selected (TRUE) then I want the answer in A1 to
be $10.50. If not checked (FALSE) I want the answer in A1to be $2.50. How
do I do this?

Thanks in advance!
 
Use a linked cell with that checkbox.

And then you can use a formula that points at that linked cell:

=if(x222=true,10.50,2.50)

(x222 is my linked cell.)
 
It would work something like this:

if checkbox1.value = true then
cell.(A1).value = $10.50
else
cell(A1).value = 2.50
end if

HTH
Thanks,
Roger
 
Hi Roger,

Thanks for the quick response. However, below is exactly what I entered,
but an error keeps popping up that says: Compile Error: Sub or Function not
defined1:

Private Sub CheckBox1_Click()

If CheckBox1.Value = True Then
cell(A1).Value = 10.5
Else
cell(A1).Value = 2.5
End If

End Sub

Any suggestions?
 
Private Sub CheckBox1_Click()
If me.CheckBox1.Value = True Then
me.range("A1").Value = 10.5
Else
me.range("a1").Value = 2.5
End If
End Sub

I like to qualify the objects (both the checkbox and the range), but that wasn't
the real problem.

me.cells(1,1).value = 10.5

would have worked ok, too.
 
Dave,

You are amazing! Just what I was looking for :) Thanks so much!!!
 

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

Back
Top