:D snasui.com ยินดีต้อนรับ :D
ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย :thup: สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ :arrow: ระบุ Version ของ Excel
:!: โปรดทราบ :!:
  1. กรุณาอ่านกฎการใช้บอร์ด (Forum rules) ในตำแหน่งด้านบนของแต่ละบอร์ด
  2. การสมัครสมาชิก การ Login การกู้คืนรหัสผ่าน
    1. สมัครสมาชิกดูขั้นตอนได้ที่ :arrow: สมัครสมาชิก
    2. Login เข้าระบบโดยคลิกปุ่ม Login ตรงมุมขวาบนของหน้านี้ :roll:
    3. การ Login ผ่าน Facebook ดูวิธีที่ :arrow: Login ผ่าน Facebook
    4. ลืมรหัสผ่านสามารถรับรหัสใหม่ได้ที่ :arrow: Reset รหัสผ่าน
  3. มีปัญหาการใช้งาน แจ้งผู้ดูแลระบบได้ที่ :arrow: ติดต่อผู้ดูแลระบบ
  4. กำหนดการตั้งค่าส่วนตัว เช่นตั้งค่าภาษาเป็นไทยหรืออังกฤษดูได้ที่ :arrow: ตั้งค่าส่วนตัว
  5. การตั้งและตอบกระทู้ดูได้ที่ :arrow: วิธีการตั้งและตอบกระทู้
  6. การจัดรูปแบบตัวอักษรด้วย bbcode ในช่องแสดงความคิดเห็นดูได้ที่ :arrow: จัดรูปแบบตัวอักษร
  7. กำหนดขนาดตัวอักษรใน Browser ดูได้ที่ :arrow: กำหนดขนาดตัวอักษรใน Browser

สอบถามเรื่องการแจ้งเตือนครับ

ฟอรัมถาม-ตอบปัญหาการใช้งานสูตรและฟังก์ชัน Excel
Forum rules
  1. ไม่อนุญาตให้ใช้ภาษาแชทในการถามและตอบปัญหา ไม่ใช้คำว่า "คับ" หรือ "อ่ะครับ" แทนคำว่า "ครับ" ไม่ใช้คำว่า "เด๋ว" แทนคำว่า "เดี๋ยว" เป็นต้น เนื่องจากเมื่อแปลเป็นภาษาต่างประเทศแล้วจะให้ความหมายผิดไปจากที่ควรจะเป็น
  2. ห้ามถามโดยระบุชื่อผู้ตอบและต้องตั้งชื่อกระทู้ให้สื่อถึงปัญหาที่จะถาม ไม่ตั้งชื่อว่า ช่วยด้วยครับ, มีปัญหามาปรึกษาครับ เป็นต้น
  3. กรุณาอธิบายปัญหาและระบุคำตอบที่ต้องการมาในกระทู้ด้วยเสมอถึงแม้จะอธิบายไว้ในไฟล์แนบแล้วก็ตาม ทั้งนี้เพื่ออำนวยความสะดวกแก่เพื่อนสมาชิกในการค้นหาข้อมูล
  4. กรุณาแนบไฟล์ตัวอย่างพร้อมแสดงคำตอบที่ถูกต้องมาในไฟล์ด้วยเพื่อให้ง่ายต่อการทำความเข้าใจและสะดวกต่อการตอบคำถาม (ขนาดไฟล์ไม่เกิน 500Kb ขนาดภาพไม่เกิน 800*600 Pixel) ไม่แนบเป็น Link มาจากแหล่งอื่นที่อาจจะถูกลบทิ้งไปโดยต้นทางในภายหลัง นอกจากนี้ไม่ควรแนบไฟล์ที่มีข้อมูลสำคัญอันก่อให้เกิดความเสียหายกับตนเองและผู้อื่น
  5. กรณีเป็นคำถามเกี่ยวกับ Programming เช่น VBA, VB.Net, C#, SQL ฯลฯ ต้องลองเขียนมาเองก่อนเสมอ ถามเฉพาะที่ติดปัญหา ระบุ Module, Procedure ที่ติดปัญหาให้ชัดเจน กรุณาโพสต์ Code ให้แสดงเป็น Code คือเปิดด้วย [code] และปิดด้วย [/code] ตัวอย่างเช่น [code]dim r as range[/code] เพื่อให้แตกต่างจากข้อความทั่วไป สะดวกในการอ่านและทดสอบ (คลิกเพื่อดูตัวอย่าง)
  6. กรุณาแจ้งผลการใช้งานเมื่อได้รับคำตอบว่าตรงกับความต้องการหรือไม่
Leng
Member
Member
Posts: 225
Joined: Tue Jun 26, 2018 5:19 pm

สอบถามเรื่องการแจ้งเตือนครับ

#1

Post by Leng »

พอดีผมต้องการเขียน vba โดยแจ้งเตือนถ้าหากไม่มีข้อมูลครับ
-ผมได้ทำการสร้าง user from และ textbox ครับ โดย textbox ที่ผมทำนั้นได้เขียน vlookup ไว้
เช่น
ถ้า textbox1 ได้ มีการลงข้อมูลว่า 1234 textbox2 ก็จะ Auto เป็น 4567 โดยการเซตข้อมูลไว้จาก sheet1

สิ่ที่ต้องการคือ
-ถ้าไม่มีข้อมูล อยากให้แจ้งเตือนว่า"กรุณาใส่ข้อมูลก่อน"
User avatar
snasui
Site Admin
Site Admin
Posts: 31257
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: สอบถามเรื่องการแจ้งเตือนครับ

#2

Post by snasui »

:D การใช้ VBA ต้องเขียนมาเองก่อนเสมอ แนบไฟล์ที่ได้เขียน Code ไว้แล้วมาถามกัน แจ้ง Procedure ที่ติดปัญหา บรรทัดที่ติดปัญหา จะได้สะดวกในการตอบครับ
Leng
Member
Member
Posts: 225
Joined: Tue Jun 26, 2018 5:19 pm

Re: สอบถามเรื่องการแจ้งเตือนครับ

#3

Post by Leng »

อาจารย์ครับไม่ทราบอาจารย์พอจะมีเว็บหรืออะไรให้ดูเป็นแนวทางไหมครับ
User avatar
snasui
Site Admin
Site Admin
Posts: 31257
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: สอบถามเรื่องการแจ้งเตือนครับ

#4

Post by snasui »

:D คงต้องลอง Search ดู เช่น Link นี้เป็นต้นครับ เตือน+VBA
Leng
Member
Member
Posts: 225
Joined: Tue Jun 26, 2018 5:19 pm

Re: สอบถามเรื่องการแจ้งเตือนครับ

#5

Post by Leng »

Code: Select all

Private Sub TextBox5_AfterUpdate()
If Me.TextBox5.Text = "" Then Exit Sub
    emptyrow = WorksheetFunction.CountA(Range("A:A")) + 1
    Worksheets("IN").Cells(emptyrow, 1).Value = TextBox1.Value
    Worksheets("IN").Cells(emptyrow, 2).Value = TextBox2.Value
    Worksheets("IN").Cells(emptyrow, 3).Value = TextBox4.Value
    Worksheets("IN").Cells(emptyrow, 4).Value = ComboBox1.Value
    Worksheets("IN").Cells(emptyrow, 5).Value = TextBox5.Value
    Worksheets("IN").Cells(emptyrow, 6).Value = TextBox6.Value
    Worksheets("IN").Cells(emptyrow, 7).Value = TextBox7.Value
    Worksheets("IN").Cells(emptyrow, 8).Value = TextBox8.Value
    Worksheets("IN").Cells(emptyrow, 9).Value = TextBox9.Value
    
    
    If WorksheetFunction.CountIf(Sheets("Data").Range("A:D"), Me.TextBox5.Value) = 0 Then
Me.TextBox5.Value = ""
End If
With Me
.TextBox6 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 2, 0)
.TextBox7 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 3, 0)
.TextBox8 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 4, 0)

End With
    End Sub
ปัญหาคือพอไม่มีข้อมูลในชีท data จะขึ้น error ครับและจะเด้งมาหน้าโค๊ดเลยรบกวนอาจารช่วยหน่อยครับถ้าไม่มีข้อมูลอยากให้ขึ้นว่า"กรุณาตรสจสอบข้อมูล.
You do not have the required permissions to view the files attached to this post.
User avatar
snasui
Site Admin
Site Admin
Posts: 31257
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: สอบถามเรื่องการแจ้งเตือนครับ

#6

Post by snasui »

:D ตัวอย่างการปรับ Code ที่ใช้ตรวจสอบว่าไม่มีข้อมูลแล้วให้ออกจาก Procedure ครับ

Code: Select all

If WorksheetFunction.CountIf(Sheets("Data").Range("A:A"), Me.TextBox5.Value) = 0 Then
    Me.TextBox5.Value = ""
    MsgBox "Not found."
    Exit Sub
End If
Leng
Member
Member
Posts: 225
Joined: Tue Jun 26, 2018 5:19 pm

Re: สอบถามเรื่องการแจ้งเตือนครับ

#7

Post by Leng »

Code: Select all

Private Sub TextBox5_AfterUpdate()
If Me.TextBox5.Text = "" Then Exit Sub
    emptyrow = WorksheetFunction.CountA(Range("A:A")) + 1
    Worksheets("IN").Cells(emptyrow, 1).Value = TextBox1.Value
    Worksheets("IN").Cells(emptyrow, 2).Value = TextBox2.Value
    Worksheets("IN").Cells(emptyrow, 3).Value = TextBox4.Value
    Worksheets("IN").Cells(emptyrow, 4).Value = ComboBox1.Value
    Worksheets("IN").Cells(emptyrow, 5).Value = TextBox5.Value
    Worksheets("IN").Cells(emptyrow, 6).Value = TextBox6.Value
    Worksheets("IN").Cells(emptyrow, 7).Value = TextBox7.Value
    Worksheets("IN").Cells(emptyrow, 8).Value = TextBox8.Value
    Worksheets("IN").Cells(emptyrow, 9).Value = TextBox9.Value
    
    
    If WorksheetFunction.CountIf(Sheets("Data").Range("A:D"), Me.TextBox5.Value) = 0 Then
Me.TextBox5.Value = ""
End If
With Me
.TextBox6 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 2, 0)
.TextBox7 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 3, 0)
.TextBox8 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 4, 0)
End With

If WorksheetFunction.CountIf(Sheets("Data").Range("A:A"), Me.TextBox5.Value) = 0 Then
    Me.TextBox5.Value = ""
    MsgBox "Not found."
    Exit Sub
End If

    End Sub
ไม่สามารถ run ได้ครับ
User avatar
snasui
Site Admin
Site Admin
Posts: 31257
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: สอบถามเรื่องการแจ้งเตือนครับ

#8

Post by snasui »

:D ใสแทน Code ด้านล่างนี้ ไม่ใช่ใส่เพิ่มครับ

Code: Select all

    If WorksheetFunction.CountIf(Sheets("Data").Range("A:D"), Me.TextBox5.Value) = 0 Then
Me.TextBox5.Value = ""
End If
ข้อสังเกต ถ้าเพิ่มผมจะบอก Code แวดล้อมไปด้วยครับ
Leng
Member
Member
Posts: 225
Joined: Tue Jun 26, 2018 5:19 pm

Re: สอบถามเรื่องการแจ้งเตือนครับ

#9

Post by Leng »

ได้ละครับ แต่ติดปัญหาคือ พอ scan แล้วข้อมูลก็จะ add ลงหมดทั้งๆที่ขึ้น MsgBox "Not found." แล้ว

Code: Select all

Private Sub TextBox5_AfterUpdate()
If Me.TextBox5.Text = "" Then Exit Sub
    emptyrow = WorksheetFunction.CountA(Range("A:A")) + 1
    Worksheets("IN").Cells(emptyrow, 1).Value = TextBox1.Value
    Worksheets("IN").Cells(emptyrow, 2).Value = TextBox2.Value
    Worksheets("IN").Cells(emptyrow, 3).Value = TextBox4.Value
    Worksheets("IN").Cells(emptyrow, 4).Value = ComboBox1.Value
    Worksheets("IN").Cells(emptyrow, 5).Value = TextBox5.Value
    Worksheets("IN").Cells(emptyrow, 6).Value = TextBox6.Value
    Worksheets("IN").Cells(emptyrow, 7).Value = TextBox7.Value
    Worksheets("IN").Cells(emptyrow, 8).Value = TextBox8.Value
    Worksheets("IN").Cells(emptyrow, 9).Value = TextBox9.Value
    
    
If WorksheetFunction.CountIf(Sheets("Data").Range("A:D"), Me.TextBox5.Value) = 0 Then
    Me.TextBox5.Value = ""
    MsgBox "Not found."
    Exit Sub
End If

With Me
.TextBox6 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 2, 0)
.TextBox7 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 3, 0)
.TextBox8 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 4, 0)
End With

If WorksheetFunction.CountIf(Sheets("Data").Range("A:D"), Me.TextBox5.Value) = 0 Then
    Me.TextBox5.Value = ""
    MsgBox "Not found."
    Exit Sub
End If

    End Sub
User avatar
snasui
Site Admin
Site Admin
Posts: 31257
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: สอบถามเรื่องการแจ้งเตือนครับ

#10

Post by snasui »

:D ลองพยายาม Debug และแก้ไขมาดูก่อน นำสิ่งที่พยายามแล้วยังติดอยู่มาถามกันต่อครับ
Leng
Member
Member
Posts: 225
Joined: Tue Jun 26, 2018 5:19 pm

Re: สอบถามเรื่องการแจ้งเตือนครับ

#11

Post by Leng »

ได้ละครับขอบคุณอาจารย์มากครับ :D :thup:

Code: Select all

Private Sub TextBox5_AfterUpdate()
If WorksheetFunction.CountIf(Sheets("Data").Range("A:D"), Me.TextBox5.Value) = 0 Then
    Me.TextBox5.Value = ""
    MsgBox "Not found."
    Exit Sub
End If
    emptyrow = WorksheetFunction.CountA(Range("A:A")) + 1
    Worksheets("IN").Cells(emptyrow, 1).Value = TextBox1.Value
    Worksheets("IN").Cells(emptyrow, 2).Value = TextBox2.Value
    Worksheets("IN").Cells(emptyrow, 3).Value = TextBox4.Value
    Worksheets("IN").Cells(emptyrow, 4).Value = ComboBox1.Value
    Worksheets("IN").Cells(emptyrow, 5).Value = TextBox5.Value
    Worksheets("IN").Cells(emptyrow, 6).Value = TextBox6.Value
    Worksheets("IN").Cells(emptyrow, 7).Value = TextBox7.Value
    Worksheets("IN").Cells(emptyrow, 8).Value = TextBox8.Value
    Worksheets("IN").Cells(emptyrow, 9).Value = TextBox9.Value

With Me
.TextBox6 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 2, 0)
.TextBox7 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 3, 0)
.TextBox8 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 4, 0)
End With

    End Sub
Leng
Member
Member
Posts: 225
Joined: Tue Jun 26, 2018 5:19 pm

Re: สอบถามเรื่องการแจ้งเตือนครับ

#12

Post by Leng »

ติดปัญหาครับรบกวนอาจารย์หน่อยครับ
-เวลาแสกนทีแรกข้อมูลไม่ขึ้นครับแต่แสกนทีที่ 2 ข้อมูลขึ้นปกติครับรบกวนอาจารย์หน่อยครับ

Code: Select all

Private Sub TextBox5_AfterUpdate()
If WorksheetFunction.CountIf(Sheets("Data").Range("A:D"), Me.TextBox5.Value) = 0 Then
    Me.TextBox5.Value = ""
    MsgBox "Not found."
    Exit Sub
End If
    emptyrow = WorksheetFunction.CountA(Range("A:A")) + 1
    Worksheets("IN").Cells(emptyrow, 1).Value = TextBox1.Value
    Worksheets("IN").Cells(emptyrow, 2).Value = TextBox2.Value
    Worksheets("IN").Cells(emptyrow, 3).Value = TextBox4.Value
    Worksheets("IN").Cells(emptyrow, 4).Value = ComboBox1.Value
    Worksheets("IN").Cells(emptyrow, 5).Value = TextBox5.Value
    Worksheets("IN").Cells(emptyrow, 6).Value = TextBox6.Value
    Worksheets("IN").Cells(emptyrow, 7).Value = TextBox7.Value
    Worksheets("IN").Cells(emptyrow, 8).Value = TextBox8.Value
    Worksheets("IN").Cells(emptyrow, 9).Value = TextBox9.Value

With Me
.TextBox6 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 2, 0)
.TextBox7 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 3, 0)
.TextBox8 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 4, 0)
End With

    End Sub
User avatar
snasui
Site Admin
Site Admin
Posts: 31257
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: สอบถามเรื่องการแจ้งเตือนครับ

#13

Post by snasui »

:D แนบไฟล์ล่าสุดมาด้วยเสมอจะได้ดูต่อไปจากนั้นครับ
Leng
Member
Member
Posts: 225
Joined: Tue Jun 26, 2018 5:19 pm

Re: สอบถามเรื่องการแจ้งเตือนครับ

#14

Post by Leng »

Code: Select all

Private Sub TextBox5_AfterUpdate()
If WorksheetFunction.CountIf(Sheets("Data").Range("A:D"), Me.TextBox5.Value) = 0 Then
    Me.TextBox5.Value = ""
    MsgBox "Not found."
    Exit Sub
End If
    emptyrow = WorksheetFunction.CountA(Range("A:A")) + 1
    Worksheets("IN").Cells(emptyrow, 1).Value = TextBox1.Value
    Worksheets("IN").Cells(emptyrow, 2).Value = TextBox2.Value
    Worksheets("IN").Cells(emptyrow, 3).Value = TextBox4.Value
    Worksheets("IN").Cells(emptyrow, 4).Value = ComboBox1.Value
    Worksheets("IN").Cells(emptyrow, 5).Value = TextBox5.Value
    Worksheets("IN").Cells(emptyrow, 6).Value = TextBox6.Value
    Worksheets("IN").Cells(emptyrow, 7).Value = TextBox7.Value
    Worksheets("IN").Cells(emptyrow, 8).Value = TextBox8.Value
    Worksheets("IN").Cells(emptyrow, 9).Value = TextBox9.Value

With Me
.TextBox6 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 2, 0)
.TextBox7 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 3, 0)
.TextBox8 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 4, 0)
End With

    End Sub
ติดปัญหาครับรบกวนอาจารย์หน่อยครับ
-เวลาแสกนทีแรกข้อมูลไม่ขึ้นครับแต่แสกนทีที่ 2 ข้อมูลขึ้นปกติครับรบกวนอาจารย์หน่อยครับ
You do not have the required permissions to view the files attached to this post.
User avatar
snasui
Site Admin
Site Admin
Posts: 31257
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: สอบถามเรื่องการแจ้งเตือนครับ

#15

Post by snasui »

:D ตัวอย่างการปรับ Code ครับ

Code: Select all

Private Sub TextBox5_AfterUpdate()
if me.textbox5.text = "" then exit sub
If WorksheetFunction.CountIf(Sheets("Data").Range("A:A"), Me.TextBox5.Value) = 0 Then
    'Me.TextBox5.Value = ""
    MsgBox "Not found."
    Exit Sub
End If
'Other code...
Leng
Member
Member
Posts: 225
Joined: Tue Jun 26, 2018 5:19 pm

Re: สอบถามเรื่องการแจ้งเตือนครับ

#16

Post by Leng »

Code: Select all

Private Sub TextBox5_AfterUpdate()
If Me.TextBox5.Text = "" Then Exit Sub
If WorksheetFunction.CountIf(Sheets("Data").Range("A:A"), Me.TextBox5.Value) = 0 Then
    'Me.TextBox5.Value = ""
    MsgBox "Not found."
    Exit Sub
End If
    emptyrow = WorksheetFunction.CountA(Range("A:A")) + 1
    Worksheets("IN").Cells(emptyrow, 1).Value = TextBox1.Value
    Worksheets("IN").Cells(emptyrow, 2).Value = TextBox2.Value
    Worksheets("IN").Cells(emptyrow, 3).Value = TextBox4.Value
    Worksheets("IN").Cells(emptyrow, 4).Value = ComboBox1.Value
    Worksheets("IN").Cells(emptyrow, 5).Value = TextBox5.Value
    Worksheets("IN").Cells(emptyrow, 6).Value = TextBox6.Value
    Worksheets("IN").Cells(emptyrow, 7).Value = TextBox7.Value
    Worksheets("IN").Cells(emptyrow, 8).Value = TextBox8.Value
    Worksheets("IN").Cells(emptyrow, 9).Value = TextBox9.Value

With Me
.TextBox6 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 2, 0)
.TextBox7 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 3, 0)
.TextBox8 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox5), Sheets("Data").Range("lookupdata"), 4, 0)
End With

    End Sub
ยังเหมือนเดิมครับ
-เวลาแสกนทีแรกข้อมูลไม่ขึ้นครับแต่แสกนทีที่ 2 ข้อมูลขึ้นปกติครับรบกวนอาจารย์หน่อยครับ
You do not have the required permissions to view the files attached to this post.
User avatar
snasui
Site Admin
Site Admin
Posts: 31257
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: สอบถามเรื่องการแจ้งเตือนครับ

#17

Post by snasui »

:D บอกค่าทดสอบมาให้ครบทุกช่องเสมือนทำงานจริงจะได้ทดสอบดูได้ ตอนนี้ผมเพียงทดสอบกรอกแค่ TextBox5 ที่ใช้ Scan เท่านั้น ซึ่งพบว่าทำงานได้ตามปกติครับ
Leng
Member
Member
Posts: 225
Joined: Tue Jun 26, 2018 5:19 pm

Re: สอบถามเรื่องการแจ้งเตือนครับ

#18

Post by Leng »

พอแสกนทีที่ 1 ข้อมูลที่ vlookup ไว้ไม่ขึ้นครับ
พอแสกนทีที่ 2 ข้อมูลที่ vlookup ขึ้นตามปกติครับ
You do not have the required permissions to view the files attached to this post.
User avatar
snasui
Site Admin
Site Admin
Posts: 31257
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 2019
Contact:

Re: สอบถามเรื่องการแจ้งเตือนครับ

#19

Post by snasui »

:D ดูแล้วไม่เข้าใจครับ

เพื่อให้การ Debug เกิดความกระชับ รวดเร็ว สิ่งที่ต้องทำคือ ให้แนบมาเฉพาะ Code ที่เกี่ยวข้องกับประเด็นปัญหา ส่วนที่ไม่เกี่ยวข้องให้ Mark ทิ้งไปก่อน
  1. Mark Code การขยายหน้าจอและซ่อนเมนูออกไป
  2. Mark การกดปุ่ม Exit แล้วปิดไฟล์ออกไป
  3. Mark การซ่อนชีตซ่อนหัวบรรทัดออกไป
จากที่ถามมาในโพสต์แรกคือตามด้านล่าง
Leng wrote: Fri Jul 13, 2018 5:16 pm พอดีผมต้องการเขียน vba โดยแจ้งเตือนถ้าหากไม่มีข้อมูลครับ
-ผมได้ทำการสร้าง user from และ textbox ครับ โดย textbox ที่ผมทำนั้นได้เขียน vlookup ไว้
เช่น
ถ้า textbox1 ได้ มีการลงข้อมูลว่า 1234 textbox2 ก็จะ Auto เป็น 4567 โดยการเซตข้อมูลไว้จาก sheet1

สิ่งที่ต้องการคือ
-ถ้าไม่มีข้อมูล อยากให้แจ้งเตือนว่า"กรุณาใส่ข้อมูลก่อน"
ช่วยทำไฟล์สภาพนี้มา หรือหากแก้ได้แล้วให้ระบุปัญหาที่เป็น ณ ปัจจุบัน แนบไฟล์ด้วยสภาพแวดล้อมที่เกิดปัญหานั้นมาอีกที อย่าลืมที่ผมแจ้งไปด้านบนว่าให้นำมาถามเฉพาะ Code ที่เกี่ยวข้องกับปัญหาเท่านั้น เพื่อให้เกิดความสะดวกต่อการเข้าถึงปัญหาครับ
Leng
Member
Member
Posts: 225
Joined: Tue Jun 26, 2018 5:19 pm

Re: สอบถามเรื่องการแจ้งเตือนครับ

#20

Post by Leng »

ต้องขอโทษด้วยครับ
You do not have the required permissions to view the files attached to this post.
Post Reply