This isn't working quite right. I want the code to check which box is
checked and put one thing in the cell, and if neither of them are cheked to
put nothing in, but I'm always just getting the second choice (6789)
irregardless of the checkbox status.
Pls help.
With tblTarget
If Check1.Checked = True Then
.Cell(1, 1).Range.Text = "12345"
If Check2.Checked = True Then
.Cell(1, 1).Range.Text = "6789"
End If
End With
---SNIP---
> With tblTarget
> If Check1.Checked = True Then
[quoted text clipped - 3 lines]
> End If
> End With
I'm not clear on your intended logic. You are missing an End If
statement somewhere, presumably immediately after the first End If. In
that case, what you have coded here will only check Check2 if Check1
was checked. It appears that the logic you want to achieve is this:
a) If Check1 and Check2 are both checked, use value "6789")
b) if Check1 only is checked, use value "12345"
c) if neither Check1 nor Check2 is checked, or if Check2 only is
checked, do not use any value (for which case you should probably
initialise the value to nil).
Correct?
NZ VBA Developer - 12 Nov 2007 23:36 GMT
Just change
If Check2.Checked = True Then
to
ElseIf Check2.Checked = True Then
and just to be safe add another line before the "End If"
Else: .Cell(1, 1).Range.Text =""
That should fix it.

Signature
Cheers!
The Kiwi Koder
> ---SNIP---
> >
[quoted text clipped - 18 lines]
>
> Correct?
Angyl - 13 Nov 2007 15:58 GMT
Thanks!!
> Just change
>
[quoted text clipped - 32 lines]
> >
> > Correct?