簡體   English   中英

如果單元格包含來自保管箱的特定值,則 VBA 宏返回不同的文本

[英]VBA macro if cell contains a specific value from a dropbox then return different text

好吧伙計們,我對 VBA 有點陌生,所以要溫柔......在 VBA 中,我創建了一個用戶表單,其中包含一個包含不同選擇的 Dropbox。 然后將該選擇放入單元格 C3。 我想要的是,根據選擇,會顯示不同的文本(例如:如果我在下拉框中單擊“測試一個”,然后在 C3 中顯示“測試一個被選中”。我嘗試使用不同的公式並注意工作...我也不確定天氣是否為此添加模塊或將其放在用戶表單的代碼中。

預先感謝您的幫助,如果我的措辭令人困惑,請見諒!

所以我想通了! 這是我的新代碼

私有子問題_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 = "Rework Purchased - Fabrication" Then Range("G3").Value = "2.5" If Problem_ComboBox.Value =“購買返工 - 機械車間”然后范圍(“G3”)。價值=“2。 6" If Problem_ComboBox.Value = "Engineering / Design Problems" 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 List / Labels / Serial Plate" Then Range("G3").Value = "3.3"

結束子

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM