ขออนุญาตสอบถามแก้ไขสูตรใน VBA ผลลัพท์ไม่ตรงและเกิดCode error ครับ
ผมสร้างฟอร์มชื่อ fr_NCDSCREEN เพื่อแสดงค่าใน Textbox จำนวน 4 box
Code: Select all
Sub ncdCountIf()
Dim ws As Worksheet
Dim x As Long
Set ws = Worksheets("ncdscreen")
RowCount = Application.CountA(Range("A:A"))
Me.TextBox1 = Application.WorksheetFunction.CountIf(Range("ncdscreen!Q4:Q100000"), ">=70") 'ผลลัพท์ไม่ตรง
Me.TextBox2 = Application.WorksheetFunction.CountIf(Range("ncdscreen!Q4:Q100000"), "<70") ผลลัพท์ตรง
Me.TextBox3 = Application.WorksheetFunction.CountA([ncdscreen!A4:A100000]) - _
Application.WorksheetFunction.CountA([ncdscreen!Q4:Q100000]) 'ผลลัพท์ตรง
Me.TextBox4 = ws.Range("Q4:Q" & RowCount).SpecialCells(xlCellTypeBlanks).Count 'เกิด error ตามภาพครับ
End Sub
Private Sub UserForm_Initialize()
Call ncdCountIf
End Sub
โดยที่รับค่าจาก Columm Q4 แต่พบปัญหาคือ
textbox1 ข้อมูลที่ได้รับไม่ตรง
textbox2 ข้อมูลตรง
textbox3 ข้อมูลตรง
textbox4 ผมลองใช้ SpecialCells(xlCellTypeBlanks) แต่เกิด error ครับ
รบกวนแนะนำวิธีแก้ไขข้อผิดพลาดของ textbox 1 และแนะนำวิธีใช้ vba ของ textbox4 ด้วยครับ
ขอบพระคุณครับ
You do not have the required permissions to view the files attached to this post.