PC Review


Reply
Thread Tools Rate Thread

Deriving a name from variables

 
 
brichard429
Guest
Posts: n/a
 
      4th Dec 2009
I have 22 CheckBox objects named CheckBox1, CheckBox2 etc. I would like to
substitue a variable to represent the name in the expression
"Sheet2.TextBox1= False" by using a do loop and varying the number portion
of the word TextBox. Any suggestions?
--
Bernie
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      4th Dec 2009
Checkboxes and textboxes from the control toolbox toolbar???

I'm not quite sure what you're doing, but maybe this will give you an idea:

Option Explicit
Sub testme()
Dim iCtr As Long
With Sheet2
For iCtr = 1 To 22
.OLEObjects("textbox" & iCtr).Object.Enabled _
= .OLEObjects("checkbox" & iCtr).Object.Value
Next iCtr
End With
End Sub




brichard429 wrote:
>
> I have 22 CheckBox objects named CheckBox1, CheckBox2 etc. I would like to
> substitue a variable to represent the name in the expression
> "Sheet2.TextBox1= False" by using a do loop and varying the number portion
> of the word TextBox. Any suggestions?
> --
> Bernie


--

Dave Peterson
 
Reply With Quote
 
brichard429
Guest
Posts: n/a
 
      4th Dec 2009
Thank You Dave. Here is the code I used to clear all of the 22 CheckBoxes of
checks using your suggestion.

Dim iCtr As Long
With Sheet2
For iCtr = 1 to 22
.OLEObjects("CheckBox" & iCtr).Object.Value = False
Next iCtr
End With
--
Bernie


"Dave Peterson" wrote:

> Checkboxes and textboxes from the control toolbox toolbar???
>
> I'm not quite sure what you're doing, but maybe this will give you an idea:
>
> Option Explicit
> Sub testme()
> Dim iCtr As Long
> With Sheet2
> For iCtr = 1 To 22
> .OLEObjects("textbox" & iCtr).Object.Enabled _
> = .OLEObjects("checkbox" & iCtr).Object.Value
> Next iCtr
> End With
> End Sub
>
>
>
>
> brichard429 wrote:
> >
> > I have 22 CheckBox objects named CheckBox1, CheckBox2 etc. I would like to
> > substitue a variable to represent the name in the expression
> > "Sheet2.TextBox1= False" by using a do loop and varying the number portion
> > of the word TextBox. Any suggestions?
> > --
> > Bernie

>
> --
>
> Dave Peterson
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
deriving a delegate Eric T. Microsoft C# .NET 3 9th Feb 2009 11:09 PM
Deriving from forms Jayme.Pechan Microsoft C# .NET 8 6th Jun 2007 03:46 AM
Deriving a new application John Microsoft VB .NET 1 2nd Sep 2006 04:33 AM
Is deriving from HybridDictionary possible? Paul Tomlinson Microsoft C# .NET 1 24th Mar 2005 02:27 PM
Deriving from C++ classes in C# Urs Wigger Microsoft C# .NET 3 13th Oct 2003 03:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:34 PM.