Thanks Rick and Dave. Your responses raise my original problem that I
don't really see an expeditious way of addressing through the newsgroup,
but let's give it a try.
I have an Excel VBA program for tracking a company's stock option
issuances that worked several years ago and I have been trying to
rejuvenate it in xl2002. It has a UserForm (uFormGrantEntry) that
requires the selection of one from about 40 option buttons for the type
of vesting; e.g., Option5yrm1yrc for an option that vests ratably by
month over 5 years, with no vesting for the 1st yr (i.e., a 1-year
"cliff"), or Option4yrq6mc for an option that vests ratably by quarter
over 4 years with a 6-month cliff, etc. Except for the option buttons
named "OptionImmediate" and "OptionCustom, all the option buttons have
names that begin with "Option" followed by a number from 1 to 5. The
code is supposed to extract the "5" (or "4", or "3", or whatever)
portion of the option button name and deposit it in the appropriate cell
on a data form worksheet, so at one point the code for this UserForm
includes
For Each opButton In uFormGrantEntry.Frame2.Controls
If TypeName(opButton) = "OptionButton" Then
If opButton Then
m = opButton.Name
'If the selected type of vesting is not "immediate" or
"custom", then
'initialize a variable to refer to the number of years
(1,2,3,4 or 5)
'in the Vesting Type
If Not m = "OptionImmediate" And Not m = "OptionCustom" Then
j = Mid(m, 7, 1) * 1
End If
Exit For
End If
End If
Next
For some reason inexplicable to me, the line j = Mid(m, 7, 1)*1 throws
an error "Cant find project or library". So I substituted
j = Right(m, Len(m) - 6) (to extract the "5yrm1yrc" portion) and got the
same error. Rather than try to solve that problem, which I don't
understand, I am considering the If . . . Then or Select Case approach.
I suppose I could go back and rename the option buttons to eliminate the
"Option" part, but there are a lot of them, and I haven't even
ascertained whether an option button name can begin with a number.
Anyway, thanks for any help. I might consider Chip's suggestion if I
can't make any progress on the underlying error message problem.
Thanks.
Alan Beban