MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Jan 14th, 2002, 05:22 PM   #1
fgiesen
New Member
 
Join Date: Jan 2002
Posts: 1
Default

Problem:
When check boxes are created they are assigned a name "check box ######" Where ##### increments from 1 - n. VB will create check boxes greater than 65535, but will error on a select method. The check box numbering sequence continues through the life of the spread sheet.
Is it possible to completely remove all knowledge of an object?
If you take this VB code, run the macro, let it run till it gets to 65535 check boxes and you'll see the error. "Select method of CheckBox class failed" on the 65536'th.

The workaround is to delete the work sheet, make new sheet which restarts the numbering. (in 6 months to a year you'll get to fix it again!)

to duplicate the symptom let this run till it stops with the error

Sub make_site_chk_box()
'
k = 1
Do While k < 66000
i = 1

Do While i < 10
' rt, dn,width, height
ActiveSheet.CheckBoxes.Add(i * 65, 0, 50, 20).Select
With Selection
.name = "box " & k
.Characters.Text = "box " & k
.LinkedCell = a10
.OnAction = "rm_chk_boxes"
End With
i = i + 1
k = k + 1
Loop
ActiveSheet.CheckBoxes.Delete

Loop
Range("A1").Select

End Sub


Verified on Office 2000 and Office XP.

Fred.
fgiesen is offline   Reply With Quote
Old Oct 1st, 2003, 07:04 AM   #2
onlyadrafter
Board Regular
 
Join Date: Aug 2003
Location: England
Posts: 4,644
Default Re: Excel Checkbox limit -- VBA errors

Hello,

I know you posted this a long time ago, but I have only recently registered, and am trying to work my way through the unanswered posts, to gain as much experience as possible. I don't know if you need this any more, but I think I have come up with a solution.

Try this code, it worked for mw in Excel 97.

Sub Macro12()
K = 1
Do While K < 66000
I = 1
Do While I < 10
ActiveSheet.Shapes("Check Box 1").Select
Selection.ShapeRange.Duplicate.Select
Selection.ShapeRange.IncrementLeft 60# * I
Selection.ShapeRange.IncrementTop -75#
Selection.Name = "BOX NO " & K
Selection.Characters.Text = "BOX " & K
Selection.LinkedCell = a10
Selection.OnAction = "rm_chk_boxes"
I = I + 1
K = K + 1
'THESE LINES JUST TO TIDY UP
If K > 5 Then
L = K - 3
ActiveSheet.Shapes("BOX NO " & L).Delete
End If
'THESE LINES JUST TO TIDY UP
Loop
'ActiveSheet.CheckBoxes.Delete
Loop
Range("A1").Select
End Sub

Hope this helps.
__________________
-------------------------
Hope this is helpful.
-------------------------
only a drafter,
but broadening my Excel knowledge.
onlyadrafter is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 01:37 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes