Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() -- HTH RP (remove nothere from the email address if mailing direct) "ltyson" wrote in message ... I have two sub routines, the first one does exactly what I want. If the checkbox on the user form is checked, then the corresponding rectangle is filled in on the worksheet. If I uncheck the check box, then the corrsponding rectangle is unfilled for lack of a better term. Sub CheckBox368_Click() i = 368 If CheckBox368 = True Then Sheets("Order_Entry").Shapes("Rectangle " & i).Select Selection.ShapeRange.Fill.ForeColor.SchemeColor = 8 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid End If If CheckBox368 = False Then Sheets("Order_Entry").Shapes("Rectangle " & i).Select Selection.ShapeRange.Fill.Visible = msoFalse End If End Sub Problem is I want the checkbox to use the variable ' i ' like the rectangle entry does, but when I change the code it always acts upon only the true portion whether I have the check box checked or not. So even if the check box is unchecked or false so to speak it sees it acts as if it is true in this sub. Sub CheckBox368_Click() i = 368 If ("CheckBox" & i) = True Then Sheets("Order_Entry").Shapes("Rectangle " & i).Select Selection.ShapeRange.Fill.ForeColor.SchemeColor = 8 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid End If If ("CheckBox" & i) = False Then Sheets("Order_Entry").Shapes("Rectangle " & i).Select Selection.ShapeRange.Fill.Visible = msoFalse End If End Sub I am sure it is just a syntex type issue but do not understand why it never sees the check box as false if I unselect it like it does in the first sub. Thanks, Larry -- ltyson ------------------------------------------------------------------------ ltyson's Profile: http://www.excelforum.com/member.php...fo&userid=2768 View this thread: http://www.excelforum.com/showthread...hreadid=397581 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Runtime Error '91' Object variable or With block variable not set | Excel Discussion (Misc queries) | |||
variable height variable width stacked bar charts | Charts and Charting in Excel | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions | |||
Run-time error '91': "Object variable or With block variable not set | Excel Programming | |||
Cells.Find error Object variable or With block variable not set | Excel Programming |