Reputation: 457
I have designed a manual form in Excel (not using the Excel Form) that links from cells in Sheet "Employee Form" to a dataset in the second sheet in the same file named "DataSet".
I managed to fill the first rows, but I can't figure out how to make it so that it can fill multiple rows after clicking a button.
So after finishing the form for employee A, the user can continue filling the form for employee B. Right now I can only make the form fill for one user only.
This is what I currently have now:
Sub Fill_form()
ActiveWorkbook.RefreshAll
Worksheets("DataSet").Range("A2:Y2").Copy
Worksheets("DataSet").Range("A2").PasteSpecial Paste:=xlPasteValues
ActiveWorkbook.Close
End Sub
Any help would be greatly appreciated. Thank you!
Upvotes: 1
Views: 129
Reputation: 761
You probably just need to use a loop:
Sub Fill_form()
dim i as Long, LastRow as Long
ActiveWorkbook.RefreshAll
LastRow = Sheets("DataSet").Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 to LastRow
Worksheets("DataSet").Range("A" & i & ":Y" & i).Copy
Worksheets("DataSet").Range("A" & i).PasteSpecial Paste:=xlPasteValues
Next
ActiveWorkbook.Close
End Sub
Hope this helps!
Upvotes: 1