Need advice

Johny

Registered User.
Local time
Today, 02:13
Joined
Jun 1, 2004
Messages
80
I need some advice on this, here is the situation:

I got 2 listboxes where only 1 can be shown. I got to ask 2 questions to the user:

2 sided?
-> NO ==> Show lisbox 1
-> YES -> Specific combination? -> NO ==> Show listbox 1 | YES -> Show listbox 2

How should I implement this? I was thinking of radiobuttons for the 2 question (2 sided-1 sided & Specific combination-Non specific combination) and changing the visible propertie.

I am a total noob in excel programming, any help would be very appreciated :)
 
Hi, Johnny,

maybe you´ll have a look at the example - I placed the elements into a worksheet as I had no further information if sheet or userform. There´s one checkbox, 2 optionbuttons and 2 listboxes on the sheet with given names and some code like

Code:
Option Explicit

Private Sub CheckBox1_Click()
With CheckBox1
  OptionButton1.Visible = .Value
  OptionButton2.Visible = .Value
  If .Value = False Then ListBox1.Visible = Not .Value
  If .Value = False Then ListBox2.Visible = .Value
End With
End Sub

Private Sub OptionButton1_Click()
With OptionButton1
  ListBox1.Visible = .Value
  ListBox2.Visible = Not .Value
End With
End Sub

Private Sub OptionButton2_Click()
With OptionButton2
  ListBox1.Visible = Not .Value
  ListBox2.Visible = .Value
End With
End Sub
in the class module of Tabelle1.

Or you´ll use 2 msgboxes for the questions - code is placed in Modul1:

Code:
Option Explicit

Sub johnny()
Dim intAnswer1 As Integer
Dim intAnswer2 As Integer
With ActiveSheet
  If MsgBox("Show 2 sides?", vbYesNo) = vbNo Then
    .ListBox1.Visible = True
    .ListBox2.Visible = False
  Else
    If MsgBox("Specific combination?", vbYesNo) = vbNo Then
      .ListBox1.Visible = True
      .ListBox2.Visible = False
    Else
      .ListBox1.Visible = False
      .ListBox2.Visible = True
    End If
  End If
End With
End Sub
Ciao,
Holger
 

Attachments

Users who are viewing this thread

Back
Top Bottom