View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Kilmer Bob Kilmer is offline
external usenet poster
 
Posts: 280
Default A VBA code that clicks a checkbox

As for what you are doing wrong, CheckBox10_Click is an event handler (a
procedure that executes when an event occurs). It is not something you can
assign a value to. If you wanted your code to execute the same code that a
mouse click would execute, you can call the event handler like any procedure
(but this would NOT change the state of the checkbox, as an actual mouse
click would).

Sub Click_Me()
If "A12" = "Mortgage" Then CheckBox10_Click
End Sub


"nevaspb " wrote in message
...
Having some difficulty with VBA code. Any help is appreciated...
What I am trying to do is to have an "IF" command that would
CHECK a checkbox in excel if a certain cell has a certain text in it,
i.e.

Sub Click_Me()
If "A12" = "Mortgage" Then CheckBox10_Click = True
End Sub

What am I doing wrong?

Thank you very much in advance.


---
Message posted from http://www.ExcelForum.com/