I have a drop down field in VBA called cbo_deptCode. I would like another set of fields called cbo_moduleCode and cbo_moduleName to be cleared of any current entry each time the user makes a selection from the drop down cbo_deptCode. The combo boxes are form controls. How can I go about achieving this?
相关问题
- Excel sunburst chart: Some labels missing
- Error handling only works once
- Error handling only works once
- Excel formula in VBA code
- Excel VBA run time error 450 from referencing a ra
相关文章
- Get column data by Column name and sheet name
- programmatically excel cells to be auto fit width
- Unregister a XLL in Excel (VBA)
- Unregister a XLL in Excel (VBA)
- How to prevent excel from truncating numbers in a
- numeric up down control in vba
- Declare a Range relative to the Active Cell with V
- What's the easiest way to create an Excel tabl
Assign a macro to cbo_deptCode.
In the macro have code like the following:
If cbo_moduleCode and cbo_moduleName are not on the same sheet as cbo_deptCode, you'll need to specify the sheet instead of calling the ActiveSheet. Also, this will fail if those aren't the actual control names.
EDIT: If you are actually using Active-X controls (though you said you were using form controls), the format is simpler:
Sheet.[controlname].value = ""
I.EActiveSheet.cbo_moduleCode.Value = ""
Or the more convoluted method (not recommended) that involves Shapes:ActiveSheet.Shapes("cbo_moduleCode").OLEFormat.Object.Object.Value = ""