返回列表 上一主題 發帖

[發問] 各位先進大家好,這次有另外的問題

本帖最後由 c_c_lai 於 2013-10-21 17:37 編輯

回復 1# wxad0285
以下是你原本的思路 (未使用 "公式->名稱管理員 " (2010)  ; "插入->定義名稱" (2003)):
  1. Private Sub ComboBox1_Change()
  2.     With UserForm1
  3.         '  IT = "模具編號" & .ComboBox1.Value
  4.         '  .ComboBox2.RowSource = Names(IT)
  5.         .ComboBox2.RowSource = "Sheet2!" & Sheets("Sheet2").Range(Chr(Asc(.ComboBox1.Value) + 1) & "1:" & Chr(Asc(.ComboBox1.Value) + 1) & "3").Address
  6.         .ComboBox2.ListIndex = 0
  7.         .CommandButton2.SetFocus
  8.     End With
  9. End Sub

  10. Private Sub ComboBox2_Change()
  11.     UserForm1.CommandButton2.SetFocus
  12. End Sub

  13. Private Sub CommandButton1_Click()
  14.     r = [a65536].End(3).Row + 1
  15.     Cells(r, 1).Value = ComboBox1.Value
  16.     Cells(r, 2).Value = ComboBox2.Value
  17. End Sub

  18. Private Sub CommandButton2_Click()
  19.     Unload UserForm1
  20. End Sub

  21. Private Sub UserForm_Initialize()
  22.     With UserForm1
  23.         '  .ComboBox1.RowSource = Names("機台")
  24.         .ComboBox1.RowSource = "Sheet2!" & Sheets("Sheet2").[A1:A3].Address
  25.         .ComboBox1.ListIndex = 0
  26.         .CommandButton2.SetFocus
  27.     End With
  28. End Sub
複製代碼

TOP

        靜思自在 : 犯錯出懺悔心,才能清淨無煩惱。
返回列表 上一主題