Userfform1
Private Sub TextBox1_AfterUpdate()
On Error Resume Next
Me.TextBox1 = CDate(Me.TextBox1)
End Sub
Private Sub TextBox2_Enter()
UserForm2.Show
End Sub
Private Sub TextBox3_Enter()
UserForm3.Show
End Sub
Private Sub CommandButton1_Click()
Dim i As Long
i = Application.WorksheetFunction.CountA(Sheet1.Range("A:A"))
For x = 1 To 4
Sheet1.Range("A" & i).End(xlToLeft).Offset(1, x - 1).Value = _
Me("textbox" & x).Value
Next x
Me.TextBox1 = ""
Me.TextBox2 = ""
Me.TextBox3 = ""
Me.TextBox4 = ""
Me.TextBox1.SetFocus
Userform2
Private Sub UserForm_Initialize()
Me.ListBox1.List = Array("Cash", "Bank", "Creditcard")
Me.ListBox1.Selected(0) = True
End Sub
Private Sub ListBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
UserForm1.TextBox2.Text = Me.ListBox1.Column(0)
Unload Me
UserForm1.TextBox2.SetFocus
End Sub
Userform3
Private Sub UserForm_Initialize()
Dim i As Long
For i = 2 To Application.WorksheetFunction.CountA(Sheet2.Range("A:A"))
Me.ListBox1.AddItem Sheet2.Cells(i, 1).Value
Next i
Me.ListBox1.Selected(0) = True
End Sub
Userform3
Private Sub UserForm_Initialize()
Dim i As Long
For i = 2 To Application.WorksheetFunction.CountA(Sheet2.Range("A:A"))
Me.ListBox1.AddItem Sheet2.Cells(i, 1).Value
Next i
Me.ListBox1.Selected(0) = True
End Sub
Private Sub ListBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
UserForm1.TextBox3.Text = Me.ListBox1.Column(0)
Unload Me
UserForm1.TextBox3.SetFocus
End Sub
No comments:
Post a Comment
Please do not enter any spam message in comment box