เรียน อาจารย์
ถ้า I4 เท่ากับค่าว่าง ให้แสดง ข้อความให้ใส่ HN
ถ้า I4 ไม่เท่ากับ ค่าว่าง ให้แสดงคำ หรือข้อความที่ค้นหา
ถ้า I4 เท่ากับค่าว่าง คลิกปุ่ม Search แล้ว Msg Box แสดงหลายครั้ง อยากให้แสดงแค่ครั้งเดียว
ต้องปรับ Code อย่างไรครับ ขอบคุณครับ
Code: Select all
ListBox1.ColumnWidths = "40,100,100,100,100,100,100"
For i = 3 To Sheet2.Range("A1000000").End(xlUp).Row
If LCase(Sheet1.Cells(4, 9).Value) = "" Then
MsgBox ("กรุณาใส่ HN")
ElseIf InStr(LCase(Sheet2.Cells(i, 2).Value), LCase(Sheet1.Cells(4, 9).Value)) <> 0 Or InStr(LCase(Sheet2.Cells(i, 4).Value), LCase(Sheet1.Cells(4, 9).Value)) <> 0 Then
Me.ListBox1.AddItem
For x = 1 To 8
Me.ListBox1.List(ListBox1.ListCount - 1, x - 1) = Sheet2.Cells(i, x)
Next x
End If
Next i
You do not have the required permissions to view the files attached to this post.