RE: Checking Options in UserForms Collection
- From: "monir" <monir@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 9 May 2005 07:49:02 -0700
In the For Each statement:
' check options in frame grpSeries
.......For Each myOption In UserForms(1).grpSeries.Controls
if I replace UserForms(1) by UserForm("frmOptSelect")
now it is "Run-time error '13': Type mismatch", and the For Each statement
is highlighted. (That is different from the earlier: "Run-time error '9':
Subscript out of range" when I used the user form index.)
Does this reveal anything?
Since I'm referring to the user form object in a standard macro, shouldn't
the reference to the user form be specific either by index or by name ?
Thanks again.
"monir" wrote:
> Patrick;
>
> Replacing UserForms(1). by Me. produced:
> ........"Compile error: Invalid use of Me keyword"
>
> Another suggestion? Thank you.
>
>
>
> "Patrick Molloy" wrote:
>
> > probably zero basedinstead of
> > UserForms(1).
> > try
> > me.
> >
> >
> >
> >
> > "monir" wrote:
> >
> > > Hi;
> > >
> > > The user form, frmOptSelect, has a number of frames, each with a number of
> > > option controls. The algoritms for all combinations of options are not
> > > currently available, so I'm disabling certain options for now.
> > > I'm trying to make sure that an option is selected in each frame on the form
> > > before I click the btnOpen button. In:
> > >
> > > Private Sub btnOpen_Click () event procedure and right at the top, I
> > > inserted:
> > > ....... CheckOptions
> > > which is a regular macro:
> > >
> > > Sub CheckOptions()
> > > Dim myOption As Control
> > > Dim myFlag As Integer
> > > .....................................................
> > > ' check options in frame grpSeries
> > > For Each myOption In UserForms(1).grpSeries.Controls
> > > .....If myOption.Value = True Then myFlag = 1
> > > Next myOption
> > > If myFlage <> 1 Then MsgBox "Select B- or GEL-Series"
> > > ......................................................
> > > ' repeat for all frames
> > > ......................................................
> > >
> > > I got " Run-time error '9': Subscript out of range", and the above For Each
> > > statement is higlighted!
> > >
> > > Any suggestions ? Thank you
.
- Follow-Ups:
- Re: Checking Options in UserForms Collection
- From: Patrick Molloy
- Re: Checking Options in UserForms Collection
- References:
- Checking Options in UserForms Collection
- From: monir
- RE: Checking Options in UserForms Collection
- From: Patrick Molloy
- RE: Checking Options in UserForms Collection
- From: monir
- Checking Options in UserForms Collection
- Prev by Date: Re: how to match up cells in different columns in Excel 2003
- Next by Date: Re: change value on a form
- Previous by thread: RE: Checking Options in UserForms Collection
- Next by thread: Re: Checking Options in UserForms Collection
- Index(es):
Loading