大大們好!
從這裡找到非常有用的資訊
拼拼貼貼之下完成了一個簡單的程式
現在有一個欄位工號需要做比對,比對正確後轉換成姓名帶入combobox
原本用case select完成,可是50筆資料我要一筆一筆輸入...實在眼花
程式如下
If IsNumeric(TextBox6.Text) Then
Dim num As Integer
num = TextBox6.Text
Else
If Not IsNumeric(TextBox6.Text) Then
MsgBox "欄位輸入必須為數值"
End If
End If
Set y = Sheets("CNC名單(All1)")
Select Case num
Case "1908"
ComboBox1.Value = "黃xx"
Case "2029"
ComboBox1.Value = "陳xx"
Case "2066"
ComboBox1.Value = "林xx"
Case "2145"
ComboBox1.Value = "陳yy"
Case "2167"
ComboBox1.Value = "陳aa"
Case "2645"
ComboBox1.Value = "劉bb"
Case "2732"
ComboBox1.Value = "洪cc"
有試過這樣寫
If IsNumeric(TextBox6.Text) Then
Dim num As Integer
num = TextBox6.Text
Else
If Not IsNumeric(TextBox6.Text) Then
MsgBox "欄位輸入必須為數值"
End If
End If
Set y = Sheets("CNC名單(All1)")
Select Case num
Case num
ComboBox1.Value = y.Range("B2", y.[B2].End(xlDown)).Value
-------------------------------------------------------------------------
腦袋實在有點打結,這樣寫法有問題嗎?
拜託各位大大指點~~~