Ik,ben vandaag halve dag bezig met deze knop op een userform
Het probleem dat ontstaat is dat als ik dit invoer en de knop gebruik hij automatisch naar onderste cel gaat .
Dus naar cel 1000284 ouzo.
De bedoeling was dat hij naar cel A3 zou gaan .
Dit heb ik van een YouTube uitleg.
Maar is er fout in ik denk iets met lastrow en active cell maar kom er niet uit.
Private Sub cmdSend_Click()
Range("A2").Select
ActiveCell.End(xlDown).Select
lastrow = ActiveCell.Row
'MsgBox lastrow
Cells(lastrow + 1, 1).Value = txtFirstName.Text
Cells(lastrow + 1, 2).Value = txtLastName.Text
Cells(lastrow + 1, 3).Value = txtMobile.Text
Range("A2").Select
txtFirstName.Text = ""
txtLastName.Text = ""
txtMobile.Text = ""
End Sub
Watch the Excel VBA training video below for all the details:
Het probleem dat ontstaat is dat als ik dit invoer en de knop gebruik hij automatisch naar onderste cel gaat .
Dus naar cel 1000284 ouzo.
De bedoeling was dat hij naar cel A3 zou gaan .
Dit heb ik van een YouTube uitleg.
Maar is er fout in ik denk iets met lastrow en active cell maar kom er niet uit.
Private Sub cmdSend_Click()
Range("A2").Select
ActiveCell.End(xlDown).Select
lastrow = ActiveCell.Row
'MsgBox lastrow
Cells(lastrow + 1, 1).Value = txtFirstName.Text
Cells(lastrow + 1, 2).Value = txtLastName.Text
Cells(lastrow + 1, 3).Value = txtMobile.Text
Range("A2").Select
txtFirstName.Text = ""
txtLastName.Text = ""
txtMobile.Text = ""
End Sub
Watch the Excel VBA training video below for all the details: