View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
WhiteFalcon WhiteFalcon is offline
external usenet poster
 
Posts: 2
Default Creating first ever userform but not going how I wanted

Thank you for taking the oppourtunity to respond to my request and I
apologize for not going in to more detail.

I am trying to make a userform known as "SelectCriteria" for my company's
employee information database to allow for the activation of an AutoFilter
that will allow the information that a user needs to be accessed when someone
needs it and it must be accessed through a command button within Excel. It is
supposed to be similar to Access but we do not have Access as part of our
network so we are using Excel instead. This is all the information I can
relay. I thank you in advance for your help.

"Bob Phillips" wrote:

Might help if you tell us what the purpose of the form is, and what doesn't
work.


--
HTH

Bob Phillips

"WhiteFalcon" wrote in message
...
I am in the process of creating my first userform. I am having much
difficulty though as the information in the Office help is not pertinent

to
what I am trying to do.

I am looking to find the flaws in these codes:

Private Sub UserForm_Initialize()
cbxData.Enabled = False
cmdOK = False
End Sub

Private Sub cbxFilter_Change()
cbxData.Enabled = True
cmdOK = False

Dim Department() As Variant
Dim Rank() As Variant
Dim Sex() As Variant

If cbxFilter.Value = "DEPARTMENT" Then
cbxData.RowSource = "Department"

'Department = VBA.Array("Department", _
"Accounting", _
"Finance", _
"Management")

ElseIf cbxFilter.Value = "RANK" Then
cbxData.RowSource = "Rank"

'Rank = VBA.Array("Rank", _
"Assistant", _
"Associate", _
"Full", _
"Instructor")

ElseIf cbxFilter.Value = "SEX" Then
cbxData.RowSource = "Sex"

'Sex = VBA.Array("Sex", _
"F", _
"M")

End If

End Sub

Private Sub cmdCancel_Click()
Unload SelectCriteria
End Sub

Private Sub cmdOK_Click()

If cbxFilter.Value = "Department" Then
Load cbxData.Value = Range("c2")
ElseIf cbxFilter.Value = "Rank" Then
Load cbxData.Value = Range("d2")
ElseIf cbxFilter.Value = "Sex" Then
Load cbxData.Value = Range("f2")

End If

Me.Hide
End Sub


If I can get over this problem then I hopefully can activate my userform

can
be run smoothly.

Thank you in advance for your help.