- 帖子
- 2035
- 主題
- 24
- 精華
- 0
- 積分
- 2031
- 點名
- 0
- 作業系統
- Win7
- 軟體版本
- Office2010
- 閱讀權限
- 100
- 性別
- 男
- 註冊時間
- 2012-3-22
- 最後登錄
- 2024-2-1
|
3#
發表於 2013-10-21 17:34
| 只看該作者
本帖最後由 c_c_lai 於 2013-10-21 17:37 編輯
回復 1# wxad0285
以下是你原本的思路 (未使用 "公式->名稱管理員 " (2010) ; "插入->定義名稱" (2003)):- Private Sub ComboBox1_Change()
- With UserForm1
- ' IT = "模具編號" & .ComboBox1.Value
- ' .ComboBox2.RowSource = Names(IT)
- .ComboBox2.RowSource = "Sheet2!" & Sheets("Sheet2").Range(Chr(Asc(.ComboBox1.Value) + 1) & "1:" & Chr(Asc(.ComboBox1.Value) + 1) & "3").Address
- .ComboBox2.ListIndex = 0
- .CommandButton2.SetFocus
- End With
- End Sub
- Private Sub ComboBox2_Change()
- UserForm1.CommandButton2.SetFocus
- End Sub
- Private Sub CommandButton1_Click()
- r = [a65536].End(3).Row + 1
- Cells(r, 1).Value = ComboBox1.Value
- Cells(r, 2).Value = ComboBox2.Value
- End Sub
- Private Sub CommandButton2_Click()
- Unload UserForm1
- End Sub
- Private Sub UserForm_Initialize()
- With UserForm1
- ' .ComboBox1.RowSource = Names("機台")
- .ComboBox1.RowSource = "Sheet2!" & Sheets("Sheet2").[A1:A3].Address
- .ComboBox1.ListIndex = 0
- .CommandButton2.SetFocus
- End With
- End Sub
複製代碼 |
|