ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   dynamic combo boxes (https://www.excelbanter.com/excel-worksheet-functions/9898-dynamic-combo-boxes.html)

tjb

dynamic combo boxes
 
OK, basically what I want is one combo box with three options: "Yes", "No"
and "Void and Reissue".

When the user selects "Yes" from the first combo box I want a second combo
box to appear and have several options to choose from that are unique to the
"Yes" selection. The options need to by linked to a range of cells (that can
be updated with a link to another file) on the same sheet.

If the user selects "No" from the first combo box I want the second combo
box to appear again and have a different set of options that are unique to
"No". Again the options need to be linked to a range of cells on the same
sheet.

If the user selects "Void and Reissue" then the second combo box will remain
hidden.

If the first combo box is cleared the second combo box should be hidden.

Here's what I've come up with so far:

Private Sub Deduct_Change()
'shows user deduction results
If Deduct.Value = "Yes" Then
Deduct2.Visible = True
Deduct2.ListFillRange = "c127:c129"
End If

If Deduct.Value = "No" Then _
Deduct2.Visible = True
Deduct2.ListFillRange = "c131:c133"
End If

If Deduct.Value = "Void and Reissue" Then _
Deduct2.Visible = False
End If

If Deduct.Value = "" Then _
Deduct2.Visible = False
End If

End Sub

It's not working though. It keeps giving an "End If without Block If" error
when I try to execute.



try this:
Private Sub Deduct_Change()
'shows user deduction results
If Deduct.Value = "Yes" Then
Deduct2.Visible = True
Deduct2.ListFillRange = "c127:c129"
else
If Deduct.Value = "No" Then
Deduct2.Visible = True
Deduct2.ListFillRange = "c131:c133"
else
If Deduct.Value = "Void and Reissue" Then
Deduct2.Visible = False
else
If Deduct.Value = "" Then
Deduct2.Visible = False
End If
end if
end if
end if
End Sub

-----Original Message-----
OK, basically what I want is one combo box with three

options: "Yes", "No"
and "Void and Reissue".

When the user selects "Yes" from the first combo box I

want a second combo
box to appear and have several options to choose from

that are unique to the
"Yes" selection. The options need to by linked to a

range of cells (that can
be updated with a link to another file) on the same sheet.

If the user selects "No" from the first combo box I want

the second combo
box to appear again and have a different set of options

that are unique to
"No". Again the options need to be linked to a range of

cells on the same
sheet.

If the user selects "Void and Reissue" then the second

combo box will remain
hidden.

If the first combo box is cleared the second combo box

should be hidden.

Here's what I've come up with so far:

Private Sub Deduct_Change()
'shows user deduction results
If Deduct.Value = "Yes" Then
Deduct2.Visible = True
Deduct2.ListFillRange = "c127:c129"
End If

If Deduct.Value = "No" Then _
Deduct2.Visible = True
Deduct2.ListFillRange = "c131:c133"
End If

If Deduct.Value = "Void and Reissue" Then _
Deduct2.Visible = False
End If

If Deduct.Value = "" Then _
Deduct2.Visible = False
End If

End Sub

It's not working though. It keeps giving an "End If

without Block If" error
when I try to execute.

.


Tim C

Try deleting the underscores at the ends of some of your lines.

Tim C

"tjb" wrote in message
...
OK, basically what I want is one combo box with three options: "Yes", "No"
and "Void and Reissue".

When the user selects "Yes" from the first combo box I want a second combo
box to appear and have several options to choose from that are unique to
the
"Yes" selection. The options need to by linked to a range of cells (that
can
be updated with a link to another file) on the same sheet.

If the user selects "No" from the first combo box I want the second combo
box to appear again and have a different set of options that are unique to
"No". Again the options need to be linked to a range of cells on the same
sheet.

If the user selects "Void and Reissue" then the second combo box will
remain
hidden.

If the first combo box is cleared the second combo box should be hidden.

Here's what I've come up with so far:

Private Sub Deduct_Change()
'shows user deduction results
If Deduct.Value = "Yes" Then
Deduct2.Visible = True
Deduct2.ListFillRange = "c127:c129"
End If

If Deduct.Value = "No" Then _
Deduct2.Visible = True
Deduct2.ListFillRange = "c131:c133"
End If

If Deduct.Value = "Void and Reissue" Then _
Deduct2.Visible = False
End If

If Deduct.Value = "" Then _
Deduct2.Visible = False
End If

End Sub

It's not working though. It keeps giving an "End If without Block If"
error
when I try to execute.





All times are GMT +1. The time now is 06:32 PM.

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