snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
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
ขอโทษที่ครับ รบกวนด้วยนะครับ