Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://excel-egy.com/forum/t4050
- ---------------------------------
- Private Sub CommandButton1_Click()
- Dim ws As Worksheet, lr As Long, i As Long, j As Long
- On Error Resume Next
- Me.TextBox7 = Me.TextBox5 * Me.TextBox6
- Me.TextBox10 = Me.TextBox8 * Me.TextBox9
- Me.TextBox13 = Me.TextBox11 * Me.TextBox12
- Me.TextBox16 = Me.TextBox14 * Me.TextBox15
- TextBox17.Value = Val(Val(TextBox7.Value) + Val(TextBox10.Value) + Val(TextBox13.Value) + Val(TextBox16.Value))
- Application.ScreenUpdating = False
- Set ws = ThisWorkbook.Worksheets(1)
- With ws
- lr = .Cells(13, 1).End(xlUp).Row + 1
- For i = 1 To 4
- If Me.Controls("TextBox" & i).Value <> "" Then
- .Cells(lr, 1).Value = Me.Controls("TextBox" & i).Value
- For j = 1 To 3
- .Cells(lr, j + 1).Value = Me.Controls("ComboBox" & i + 4 * j - 4).Value
- Next j
- For j = 1 To 3
- .Cells(lr, j + 4).Value = Me.Controls("TextBox" & 3 * i + j + 1).Value
- Next j
- lr = lr + 1
- If lr = 13 Then MsgBox "No More Rows", vbExclamation: Exit Sub
- End If
- Next i
- End With
- Application.CutCopyMode = False
- Application.ScreenUpdating = True
- MsgBox "Done...", 64
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement