View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
rbbbbeee rbbbbeee is offline
external usenet poster
 
Posts: 9
Default Checkbox procedures

Thanks Dave! I believe that I will just link to another cell as you
suggested. Much easier.


"Dave Peterson" wrote:

How about dropping the code and just using a linked cell and then point at that
linked cell.

I dropped a checkbox from the Forms toolbar onto a worksheet.
I rightclicked on that checkbox and chose format control
Then on the control tab, I added an address for the Cell Link. (I used B3, but
you could use any cell you want.)

Then in B4, I put this formula:
=if(b3=true,"YES","")

And I gave B3 a custom format of:
;;;
(3 semicolons, so I couldn't see the True/False in the worksheet.)

=========
If you really, really want code (I wouldn't!)...

You could assign this macro to the checkbox:

Option Explicit
Sub testme01()

Dim myCBX As CheckBox

Set myCBX = ActiveSheet.CheckBoxes(Application.Caller)

If myCBX.Value = xlOn Then
activesheet.range("B4").value = "YES"
Else
activesheet.range("B4").clearcontents
End If

End Sub

rbbbbeee wrote:

I have tried several different things and I don't know alot about checkbox
procedures.
This is what I want to do. I have a checkbox in a worksheet lets say at
cell B3. I want the cell at B4 to contain the word "YES" when the checkbox
is ticked and blank when the box is not ticked.
Could someone please write me the code that will do what I am wanting to do,
then I can expand on it as I need to.

Thanks,
Russ


--

Dave Peterson