Jump to content

option buttons

Featured Replies

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:

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?

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

Archived

This topic is now archived and is closed to further replies.

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.