LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default variable help....


I have two sub routines, the first one does exactly what I want. If th
checkbox on the user form is checked, then the corresponding rectangl
is filled in on the worksheet. If I uncheck the check box, then th
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 th
rectangle entry does, but when I change the code it always acts upo
only the true portion whether I have the check box checked or not. S
even if the check box is unchecked or false so to speak it sees it act
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 i
never sees the check box as false if I unselect it like it does in th
first sub.

Thanks,
Larr

--
ltyso
-----------------------------------------------------------------------
ltyson's Profile: http://www.excelforum.com/member.php...nfo&userid=276
View this thread: http://www.excelforum.com/showthread.php?threadid=39758

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
variable height variable width stacked bar charts ambthiru Charts and Charting in Excel 3 January 18th 06 11:41 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


All times are GMT +1. The time now is 02:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"