Saturday, 30 July 2016

excel - What is the VBA formula to copy and paste the Output from a User Form into multiple rows

I have created a User Form in Excel that follows the following VBA code:



Private Sub CommandButton1_Click()

If TextBox1.Value = "" Then
If MsgBox("Form is not complete. Continue?", vbQuestion + vbYesNo) <> vbYes Then
Exit Sub
End If

End If

ActiveCell = TextBox1.Value

ActiveCell.Offset(20, 0).Select

Call resetForm

End Sub


Sub resetForm()

TextBox1.Value = ""
UserForm1.TextBox1.SetFocus

End Sub


This VBA code provides me the result generated in the User Form in the active cell of the WorkSheet.




I want to copy and paste this result into 18 rows below and then the active cell should be offset to the row below this cell.



The idea being if a User generates another result through the User Form (command button) will copy and paste this result 18 rows below and then the active cell should be offset to the row below this cell.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...