อยากให้ label ใน userform แสดงเงื่อนไขที่เรากำหนดโดยที่ไม่ต้องคลิก
Posted: Thu Dec 13, 2018 2:42 am
ตอนนี้ label ใน User from ของผมแสดงแต่ต้องคลิกเอา อยากให้เงื่อนไขตรงกันแล้วแสดงผลเลย รบกวนด้วยครับ
คลังคำตอบแห่งความรู้จากคนไทย เพื่อโลกที่ต้องการเข้าใจในสิ่งเล็ก ๆ อย่างลึกซึ้ง
https://www.snasui.com/
Option Explicit
Dim currentRow As Long
Dim lastRow As Long
' ======================================================================================================
Private Sub cmdPreviousData_Click()
subPosition
If currentRow < 3 Then
MsgBox "Already at begining of list!"
Else
currentRow = currentRow - 1
txtFirstName.Text = Cells(currentRow, 1).Value
txtLastName.Text = Cells(currentRow, 2).Value
End If
subPosition
End Sub
' ======================================================================================================
Private Sub cmdGetNextData_Click()
subPosition
If currentRow >= lastRow Then
MsgBox "Already at end of list!"
Else
currentRow = currentRow + 1
txtFirstName.Text = Cells(currentRow, 1).Value
txtLastName.Text = Cells(currentRow, 2).Value
End If
subPosition
End Sub
Private Sub Label11_Click()
If txtFirstName.Text = "" Then
Label11 = ""
ElseIf txtLastName.Text = "" Then
Label11 = ""
ElseIf txtFirstName.Text = txtLastName.Text Then
Label11 = "OK"
Else
Label11 = "NG"
End If
End Sub
' ======================================================================================================
Private Sub cndSend_Click()
With ActiveSheet
currentRow = .Cells(.Rows.Count, "A").End(xlUp).Row
currentRow = currentRow + 1
End With
Cells(currentRow, 1).Value = txtFirstName.Text
Cells(currentRow, 2).Value = txtLastName.Text
'Cells(currentRow, 3).Value = TextBox1.Text