Jump to content

option buttons


Guest sootie

Recommended Posts

I am unable to get the option buttons to work

can any one please help me

I am using excel 2003

This is my code

 

Private Sub cmdOK_Click()

Sheets("Student Details").Select

If optCGA.Value Then

Sheets("Student Details").Select

Range("Filter_Area").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange _

:=Range("ChooseGroup"), Unique:=False

 

ElseIf optCGB.Value Then

Sheets("Student Details").Select

Range("Group").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange _

:=Range("ChooseGroup"), Unique:=False

 

ElseIf optCGC.Value Then

Sheets("Student Details").Select

Range("Group").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange _

:=Range("ChooseGroup"), Unique:=False

 

ElseIf optCGD.Value Then

Sheets("Student Details").Select

Range("Group").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange _

:=Range("ChooseGroup"), Unique:=False

 

End If

Unload Me

End Sub

If any one could help I would appreciate it

Thanks

:eek:

Link to comment
Share on other sites

right, i havent done this kind of programming for a while (well ages,) the last thing i did was basic linky buttons... however it is kind of hard to troubleshoot a thing like that when i have seen the worksheet (that's all the spreadsheets).

 

maybe you just put a name in wrong or something!

 

other than that are you sure that the ending is correct?

 

also, what happens when you do click it? what does it say/do?

Link to comment
Share on other sites

Thanks I have actually solved it

check it out

 

Private Sub CommandButton1_Click()

If OptionButton1.Value = False Or OptionButton2.Value = False Then

MsgBox ("You must select an option")

End If

End Sub

Private Sub cmdOK_Click()

Sheets("Student Details").Select

If optCGA.Value Then

With Sheets("Student Details")

.Range("K3") = "A"

.Range("Filter_Area").AdvancedFilter _

Action:=xlFilterInPlace, CriteriaRange _

:=Range("GroupA"), Unique:=False

End With

 

ElseIf optCGB.Value Then

With Sheets("Student Details")

.Range("K3") = "B"

.Range("Filter_Area").AdvancedFilter _

Action:=xlFilterInPlace, CriteriaRange _

:=Range("GroupB"), Unique:=False

End With

 

ElseIf optCGC.Value Then

With Sheets("Student Details")

.Range("K3") = "C"

.Range("Filter_Area").AdvancedFilter _

Action:=xlFilterInPlace, CriteriaRange _

:=Range("GroupC"), Unique:=False

End With

 

ElseIf optCGD.Value Then

With Sheets("Student Details")

.Range("K3") = "D"

.Range("Filter_Area").AdvancedFilter _

Action:=xlFilterInPlace, CriteriaRange _

:=Range("GroupD"), Unique:=False

End With

 

End If

 

Unload Me

End Sub

 

 

 

The groups criteria stayed on the fixed Data sheet but had to be different name ranges for each one on the Fixed Data sheet it looks like this

Column and line

K2 L2 M2 N2

_______________________________________

Group Group Group Group

A B C D

 

 

IT WORKS YEHA!!!

 

 

What a much a do about nothing

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.