LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Checkboxes and Arrays

It looks like you could use this:

With Worksheets("INTRO")
For bound = LBound(all_boxes) To UBound(all_boxes)
.OLEObjects(all_boxes(bound)).Object.Value = select_all.Value
Next bound
End With

baconcow wrote:

Hey,

I really need to get used to the bounds. That is the second time the bounds
have held me back. I think I understand them too. The code seems to
automatically find out the upper and lower bounds without having to display
them. In the end, this code worked and compiled great:

With Worksheets("INTRO")
If select_all.Value = True Then
For bound = LBound(all_boxes) To UBound(all_boxes)
.OLEObjects(all_boxes(bound)).Object.Value = True
Next bound
Else
For bound = LBound(all_boxes) To UBound(all_boxes)
.OLEObjects(all_boxes(bound)).Object.Value = False
Next bound
End If
End With

You're really great with this stuff. You must do this for your occupation,
correct?

"Dave Peterson" wrote:

dim all_boxes as variant
dim bCtr as long
all_boxes = Array("create_111", "create_112", "create_113")

with Worksheets("INTRO")
for bctr = lbound(all_boxes) to ubound(all_boxes)
.oleobjects(all_boxes(bctr)).object.value = false
next bctr
end with

(Untested, uncompiled. Watch for typos.)

baconcow wrote:

When working with Check Boxes, is it not possible to use arrays to keep track
of them, as with worksheets?

SET UP

Dim all_boxes As Variant

' setting up ranges
Set range_create = Worksheets("INTRO").Range("F7")

What I am trying to do:

' create array listing the names of every possible sheet (there are MANY
more sheets than listed here)
all_boxes = Array("create_111", "create_112", "create_113")

' select all other check boxes by making them true
For offset_var = 0 To 2 (there are normally 27 check boxes)
Worksheets("INTRO").Array(all_boxes(offset_var)).V alue = True
Next offset_var

What works:

Worksheets("INTRO").create_111 = True
Worksheets("INTRO").create_112 = True
Worksheets("INTRO").create_113 = True

' etc... this takes up a LOT of space, and I always like trying to make more
efficient code, if possible

Problem:

"Object doesn't support this property or method"

Attempts to fix it:

- I have tried putting the names in the array without "" (quotation marks)

- I have tried removing the Array
Worksheets("INTRO").(all_boxes(offset_var)).Value

- I have tried without the Value
Worksheets("INTRO").(all_boxes(offset_var))

- I have tried using Shapes with and without Value
Worksheets("INTRO").Shapes(all_boxes(offset_var))
Worksheets("INTRO").Shapes(all_boxes(offset_var)). Value

It is problem something extremely simple...

Thanks for any help!


--

Dave Peterson


--

Dave Peterson
 
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
Trouble with arrays (transferring values between two arrays) Keith R[_2_] Excel Programming 4 November 14th 07 12:00 AM
Variable arrays & checkboxes Ray Excel Programming 3 June 21st 07 11:53 PM
Working with ranges in arrays... or an introduction to arrays Glen Excel Programming 5 September 10th 06 08:32 AM
Arrays - declaration, adding values to arrays and calculation Maxi[_2_] Excel Programming 1 August 17th 06 04:13 PM
Checkboxes Tom Ogilvy Excel Programming 0 August 11th 03 05:45 PM


All times are GMT +1. The time now is 10:41 PM.

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

About Us

"It's about Microsoft Excel"