พอดีผมเอาโค้ดที่อาจารย์มาแล้วไม่ทำงานครับ ผมจึงใส่โค้ดตามที่ผมส่งให้ดูเข้าไปใหม่ครับ แต่เมื่อเลือกรหัสสินค้าแล้วที่ UserForm ที่ Sheet 3 (ทำรายการ) Textbox (txtProductName),(txtPaticular),(txtColor),(txtSpec) ไม่ยอมแสดงค่าที่ต้องการครับ ถ้าถ้าเป็น TEXT เช่น AAA ข้อมูล (รายการสินค้า)ตั้งแต่ Colum C:J ก็จะมาแสดง แต่ถ้าเป็นตัวเลข จะไม่แสดงข้อมูลเลยครับ
ต้องปรับสูตรอย่างไรครับ ขอบคุณครับ
Code: Select all
Private Sub cbProductCode_Enter()
Dim i As Integer
Dim final As Integer
Dim work As String
cbProductCode.BackColor = &H80000005
For i = 1 To cbProductCode.ListCount
'Remove an item from the ListBox.
cbProductCode.RemoveItem 0
Next i
For i = 2 To 1000
If Sheet1.Cells(i, 2) = "" Then
final = i - 1
Exit For
End If
Next
'If ComboBox1.ListCount < 1 Then
'ComboBox1.AddItem "-"
For i = 2 To final
work = Sheet1.Cells(i, 2)
cbProductCode.AddItem (work)
Next
'End If
End Sub
Private Sub cbProductCode_Click()
Dim i As Integer
Dim final As Integer
For i = 2 To 1000
If Sheet1.Cells(i, 2) = "" Then
final = i - 1
Exit For
End If
Next
For i = 2 To final
If cbProductCode = Sheet1.Cells(i, 2) Then
txtProductName = Sheet1.Cells(i, 3)
txtPaticular = Sheet1.Cells(i, 4)
txtColor = Sheet1.Cells(i, 5)
txtSpec = Sheet1.Cells(i, 6)
Exit For
End If
Next
End Sub
You do not have the required permissions to view the files attached to this post.