ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Coding (?) (https://www.excelbanter.com/excel-programming/329653-vba-coding.html)

Larry G.

VBA Coding (?)
 
I am adding a couple of combo boxes to my spreadsheet, one is a list of
Rules, the other combo box list items will depend upon which rule is selected.

For example if the user selects "Confined Space Entry" then the Details box
will have a list of details that only relate to that rule.

What I am thinking needs to be done is have VBA code written that will say
something like this:

if cell(A49).value = 6
then combobox123 ?????

here is where I need help. I am not a stranger to VB programming, just how
to use it with office products.

I have a separate sheet that is the storage area for all the lists that I am
using. So I am assuming that I need to make the second list box's value range
dependent upon which item is selected in list box 1.



Alok

VBA Coding (?)
 
You presumably have two combo boxes say cbo1 and cbo2
If the items in cbo2 depend on the selection made in cbo1 then you have to
write a procedure, say RefreshListIncbo2, which will take a single parameter
- a string value, the item selected in cbo1, and populate cbo2.

Sub RefreshListIncbo2(Byval sItemInCbo1 as String)
'does things like clear the existing cbo2 and populates it again
'based on sItemInCbo1
End Sub

This Sub should be called from the Cbo1_Change event
Private Sub Cbo1_Change()
RefreshListInCbo2 Sheet1.Cbo1.Text
End Sub

Hope this is clear

Alok Joshi
"Larry G." wrote:

I am adding a couple of combo boxes to my spreadsheet, one is a list of
Rules, the other combo box list items will depend upon which rule is selected.

For example if the user selects "Confined Space Entry" then the Details box
will have a list of details that only relate to that rule.

What I am thinking needs to be done is have VBA code written that will say
something like this:

if cell(A49).value = 6
then combobox123 ?????

here is where I need help. I am not a stranger to VB programming, just how
to use it with office products.

I have a separate sheet that is the storage area for all the lists that I am
using. So I am assuming that I need to make the second list box's value range
dependent upon which item is selected in list box 1.




All times are GMT +1. The time now is 12:57 PM.

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