ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic Entries (https://www.excelbanter.com/excel-programming/329025-dynamic-entries.html)

Richard

Dynamic Entries
 
Hello,

I am trying to make a form where there will be a choice between A and B.
Should option A be selected within the form, I need a list to appear - say
options 1-10; should B be selected, I need a different list to appear. Can
anybody shed some insight please?

Thanks in advance,
Richard

Bob Phillips[_7_]

Dynamic Entries
 
Perhaps

Private Sub OptionButton1_Click()
ListBox1.RowSource = "A1:A10"
ListBox1.ListIndex = 1

End Sub

Private Sub OptionButton2_Click()
ListBox1.RowSource = "B1:B10"
ListBox1.ListIndex = 1

End Sub

--
HTH

Bob Phillips

"Richard" wrote in message
...
Hello,

I am trying to make a form where there will be a choice between A and B.
Should option A be selected within the form, I need a list to appear - say
options 1-10; should B be selected, I need a different list to appear.

Can
anybody shed some insight please?

Thanks in advance,
Richard




sebastienm

Dynamic Entries
 
Hi,
Assuming you have:
- 2 option buttons: optA and optB
- a frame fraA containing the controls (options buttons or listbox...) to be
displayed when optA is selected
- a frame fraB containing the controls (options buttons or listbox...) to be
displayued when optB is selected.
Use the code below to alternate the display when optA or optB is clicked.

'--------------------------------------------
Sub ChangeForm()
If optA.Value = True Then
fraB.Visible = False
fraA.Visible = True
Else
fraA.Visible = False
fraB.Visible = True
End If
End Sub

Private Sub optA_Change()
ChangeForm
End Sub

Private Sub optB_Change()
ChangeForm
End Sub
'--------------------------------------

Regards,
Sébastien

"Richard" wrote:

Hello,

I am trying to make a form where there will be a choice between A and B.
Should option A be selected within the form, I need a list to appear - say
options 1-10; should B be selected, I need a different list to appear. Can
anybody shed some insight please?

Thanks in advance,
Richard


Tom Ogilvy

Dynamic Entries
 
A userform? A worksheet made to look like a paper form? what do you mean by
Form?

How does the user make a choice?

When you say a list will appear - you mean a listbox?

The more detail you can describe, the more focused the answer will be.

--
Regards,
Tom Ogilvy

"Richard" wrote in message
...
Hello,

I am trying to make a form where there will be a choice between A and B.
Should option A be selected within the form, I need a list to appear - say
options 1-10; should B be selected, I need a different list to appear.

Can
anybody shed some insight please?

Thanks in advance,
Richard




Richard

Dynamic Entries
 
There is for example; combobox A where there are say 2 items. If Item #1 is
selected, then Combobox B has say 10 items to choose from. If item #2 is
selected from combobox A, then combobox B has 7 items to choose from.

Thanks,
Richard

"Tom Ogilvy" wrote:

A userform? A worksheet made to look like a paper form? what do you mean by
Form?

How does the user make a choice?

When you say a list will appear - you mean a listbox?

The more detail you can describe, the more focused the answer will be.

--
Regards,
Tom Ogilvy

"Richard" wrote in message
...
Hello,

I am trying to make a form where there will be a choice between A and B.
Should option A be selected within the form, I need a list to appear - say
options 1-10; should B be selected, I need a different list to appear.

Can
anybody shed some insight please?

Thanks in advance,
Richard





Bob Phillips[_7_]

Dynamic Entries
 
Private Sub ComboBox1_Change()
If ComboBox1.Value = "a" Then
ComboBox2.RowSource = "A1:A10"
Else
ComboBox2.RowSource = "B1:B10"
End If
ComboBox2.ListIndex = 0

End Sub


--
HTH

Bob Phillips

"Richard" wrote in message
...
There is for example; combobox A where there are say 2 items. If Item #1

is
selected, then Combobox B has say 10 items to choose from. If item #2 is
selected from combobox A, then combobox B has 7 items to choose from.

Thanks,
Richard

"Tom Ogilvy" wrote:

A userform? A worksheet made to look like a paper form? what do you

mean by
Form?

How does the user make a choice?

When you say a list will appear - you mean a listbox?

The more detail you can describe, the more focused the answer will be.

--
Regards,
Tom Ogilvy

"Richard" wrote in message
...
Hello,

I am trying to make a form where there will be a choice between A and

B.


All times are GMT +1. The time now is 02:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com