Stuck on CheckBox Code

fpskidmark

Board Regular
Joined
Sep 11, 2009
Messages
139
Hello VBA Experts,

I'm looking for a code that would "check" the checkbox, if the MCA = "Baldwin Park", "South Bay" or "Bellflower". Any suggestions?

For Each o In Workbooks("SCAL MOB POS Collection.xls").Sheets("Trend").OLEObjects
If TypeName(o.Object) = "CheckBox" Then o.Object.Value = 1
Next o
MCA.JPG


Thank you,
FP
 
Last edited:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi,
MCA appears to be an image, if its a word then something like

if checkbox1.value = "Baldwin Park" or etc etc then
'do stuff
else
'do something else
end if

i dont think i understand exactly what you are after
 
Upvote 0
Hi Bensonsearch,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
Maybe the image below can clarify what I'm trying to "say"<o:p></o:p>
If B89 = "<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:place w:st="on"><st1:City w:st="on">Baldwin Park</st1:City></st1:place>", then check the checkbox in range ("C89").<o:p></o:p>
(The checkboxes are listed in column C - I wasn't able to copy & paste the checkboxes)
<o:p></o:p>
PHP:
 If Range("B89") = "Baldwin Park" Then CheckBox2 = True

Column "B" Column "C"
<TABLE style="WIDTH: 128pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=170 border=0 x:str><COLGROUP><COL style="WIDTH: 93pt; mso-width-source: userset; mso-width-alt: 4534" width=124><COL style="WIDTH: 35pt; mso-width-source: userset; mso-width-alt: 1682" width=46><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD class=xl24 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 93pt; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 12.75pt; BACKGROUND-COLOR: silver" width=124 height=17>MCA</TD><TD class=xl24 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: silver" width=46>Show</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl25 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Antelope Valley</TD><TD class=xl26 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:rect id=_x0000_s1025 style="MARGIN-TOP: 1.5pt; Z-INDEX: 1; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Baldwin Park</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1026 style="MARGIN-TOP: 1.5pt; Z-INDEX: 2; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Bellflower</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1027 style="MARGIN-TOP: 1.5pt; Z-INDEX: 3; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Buena Ventura</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1028 style="MARGIN-TOP: 1.5pt; Z-INDEX: 4; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Fontana</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1029 style="MARGIN-TOP: 1.5pt; Z-INDEX: 5; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Kern County</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1030 style="MARGIN-TOP: 1.5pt; Z-INDEX: 6; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Los Angeles</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1031 style="MARGIN-TOP: 1.5pt; Z-INDEX: 7; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Moreno Valley</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1032 style="MARGIN-TOP: 1.5pt; Z-INDEX: 8; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Orange County</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1033 style="MARGIN-TOP: 1.5pt; Z-INDEX: 9; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Panorama City</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1034 style="MARGIN-TOP: 1.5pt; Z-INDEX: 10; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Riverside</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1035 style="MARGIN-TOP: 1.5pt; Z-INDEX: 11; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>San Diego</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1036 style="MARGIN-TOP: 1.5pt; Z-INDEX: 12; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>South Bay</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1037 style="MARGIN-TOP: 1.5pt; Z-INDEX: 13; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>West LA</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1038 style="MARGIN-TOP: 1.5pt; Z-INDEX: 14; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl27 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Woodland Hills</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1039 style="MARGIN-TOP: 1.5pt; Z-INDEX: 15; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl29 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: black 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>Region</TD><TD class=xl28 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: #ece9d8; BORDER-LEFT: windowtext; WIDTH: 35pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: #ffcc99" width=46 height=17><v:rect id=_x0000_s1040 style="MARGIN-TOP: 1.5pt; Z-INDEX: 16; MARGIN-LEFT: 3.75pt; WIDTH: 24.75pt; POSITION: absolute; HEIGHT: 9.75pt" o:insetmode="auto" strokecolor="windowText [64]" fillcolor="window [65]"></v:rect></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17></TD><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent"></TD></TR></TBODY></TABLE>
 
Upvote 0
Nevermind Bensonsearch, I figured it out!
Thank anway.

PHP:
   Sheets("Trend").Shapes("BP").Select
    Application.Goto Reference:="ShowBP": ActiveCell.FormulaR1C1 = "true"
    Application.Goto Reference:="ShowBF": ActiveCell.FormulaR1C1 = "true"
    Application.Goto Reference:="ShowSB": ActiveCell.FormulaR1C1 = "true"
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,849
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top