0
我正在創建用於在清單電子表格上使用的用戶界面。在這個例子中,我試圖顯示選定用戶的細節以進行編輯或刪除。使用基於下拉選擇的電子表格數據填充文本框excel
我打算使用循環遍歷一列用戶名,當它擊中選定的用戶名時停止,並使用從電子表格獲得的值填充顯示的實體(這些詳細信息與用戶名位於同一行)
下面是代碼的樣子的例子。
Dim nameRange As Range
Set nameRange = Range("A2:A100")
For Each x In nameRange
If x = UserFrameUserDropdown.Value Then
UserFrame_FName.Value = **<code to go here>**
UserFrame_LName.Value = **<code to go here>**
UserFrame_Country.Value = **<code to go here>**
UserFrame_State.Value = **<code to go here>**
UserFrame_Position.Value = **<code to go here>**
Exit Sub
End If
Next
任何幫助表示讚賞。
我已將代碼添加到UserFrameUserDropdown_Change子項中,但是當值更改時沒有填充。 可能是因爲x沒有被定義爲一個單元格嗎? – uberthane
Private Sub UserFrameUserDropdown_Change() *您的代碼在這裏* End Sub – Silenxor
多數民衆贊成在哪裏。 我改變FName參數線路此基於另一答案: UserFrame_FName.Value =纈氨酸(x.offset(0,2)) 結果是FName參數盒中有一個0。 – uberthane