View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default User form trouble

Patty,

Bob's code assumes that the list box is named Formulas. Change that to the
name of your list box.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Patty" wrote in message
...
Bob

When I go to test this form below I get an Compile error
that states, "With objects must be user-defined type,
object or variant" OK/Help.

I looked in the help file and did not really see anything
that would help me.

Any suggestions.
Patty


-----Original Message-----
Patty,

This is what I think you want. The 2 macros can be in the

form module or in
a general module (my preference), but doing your code.

Private Sub Calculate_Click()

Select Case Formulas.ListIndex
Case 0: FeetPerRoll
Case 1: ImpresssionsPerRoll
End Select

End Sub

Private Sub UserForm_Activate()
With Formulas
.Clear
.AddItem "Feet Per Roll"
.AddItem "Impressions Per Roll"
.ListIndex = 0
End With
End Sub

Sub FeetPerRoll()
MsgBox "Feet Per Roll"
End Sub

Sub ImpresssionsPerRoll()
MsgBox "Impressions Per Roll"
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)