首页 > 解决方案 > 使用与 Dropbox 选择不同的文本更新单元格

问题描述

我创建了一个用户表单,其中包含一个包含不同选择的下拉框。然后将该选择放入单元格 C3。

我希望根据选择显示不同的文本。例如:如果我在下拉框中单击“测试一个”,则在 C3 中显示“选择了测试一个”。

我尝试了不同的公式。
我也不确定是为此添加一个模块还是将其放在用户表单的代码中。

标签: excelvba

解决方案


所以我想通了!这是我的新代码

私人子问题_ComboBox_Change()

Range("G3").Value = Problem_ComboBox.Text

If Problem_ComboBox.Value = "Parts On ZMIT - Vendor" Then Range("G3").Value = "1.1" If Problem_ComboBox.Value = "Parts On ZMIT - Internal" Then Range("G3").Value = "1.2" If Problem_ComboBox.Value = "Parts Not On ZMIT" Then Range("G3").Value = "1.3" If Problem_ComboBox.Value = "Waiting On Parts Warehouse" Then Range("G3").Value = "1.4" If Problem_ComboBox .Value = "Waiting On Parts Runner" Then Range("G3").Value = "1.5" If Problem_ComboBox.Value = "Rework Internal Manufacture - Assembly" Then Range("G3").Value = "2.1" If Problem_ComboBox. Value = "Rework Internal Manufacture - Fabrication" Then Range("G3").Value = "2.2" If Problem_ComboBox.Value = "Rework Internal Manufacture - Machine Shop" Then Range("G3").Value = "2.3" If Problem_ComboBox.Value = "Rework Purchased - Assembly" Then Range("G3").Value = "2.4" If Problem_ComboBox. Value = "购买的返工 - 制造" Then Range("G3").Value = "2.5" If Problem_ComboBox.Value = "购买的返工 - 机械车间" Then Range("G3").Value = "2.6" If Problem_ComboBox.Value = "工程/设计问题" Then Range("G3").Value = "3.1" If Problem_ComboBox.Value = "0-Series Build" Then Range("G3").Value = "3.2" If Problem_ComboBox.Value = "等待装箱单/标签/序列板”然后范围(“G3”).Value =“3.3”返工内部制造 - 机械车间" Then Range("G3").Value = "2.3" If Problem_ComboBox.Value = "Rework Purchased - Assembly" Then Range("G3").Value = "2.4" If Problem_ComboBox.Value = "购买的返工 - 制造” Then Range("G3").Value = "2.5" If Problem_ComboBox.Value = "购买的返工 - 机械车间" Then Range("G3").Value = "2.6" If Problem_ComboBox.Value = "Engineering / 设计问题" Then Range("G3").Value = "3.1" If Problem_ComboBox.Value = "0-Series Build" Then Range("G3").Value = "3.2" If Problem_ComboBox.Value = "Waiting On Packing列表/标签/序列板”然后是 Range(“G3”).Value = “3.3”返工内部制造 - 机械车间" Then Range("G3").Value = "2.3" If Problem_ComboBox.Value = "Rework Purchased - Assembly" Then Range("G3").Value = "2.4" If Problem_ComboBox.Value = "购买的返工 - 制造” Then Range("G3").Value = "2.5" If Problem_ComboBox.Value = "购买的返工 - 机械车间" Then Range("G3").Value = "2.6" If Problem_ComboBox.Value = "Engineering / 设计问题" Then Range("G3").Value = "3.1" If Problem_ComboBox.Value = "0-Series Build" Then Range("G3").Value = "3.2" If Problem_ComboBox.Value = "Waiting On Packing列表/标签/序列板”然后是 Range(“G3”).Value = “3.3”

结束子


推荐阅读