Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://excel-egy.com/forum/t4206
- ---------------------------------
- Private Sub TextBox1_AfterUpdate()
- Dim x, b As Boolean, ws As Worksheet, m As Double, i As Integer
- For i = 1 To 5
- Set ws = ThisWorkbook.Worksheets(i)
- x = Application.Match(Val(TextBox1.Value), ws.Columns(1), 0)
- If Not IsError(x) Then
- If b = False Then TextBox2.Value = ws.Cells(x, 2).Value: b = True
- For j = 1 To 3
- Me.Controls("TextBox" & 3 * i + j - 1).Value = ws.Cells(x, j + 2).Value
- If j = 1 Or j = 2 Then Me.Controls("TextBox" & 3 * i + j - 1).Value = Format(Me.Controls("TextBox" & 3 * i + j - 1).Value, "yyyy/mm/dd")
- If j = 3 Then m = m + Val(Me.Controls("TextBox" & 3 * i + j - 1).Value)
- Next j
- TextBox18.Value = m
- End If
- Next i
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement