Creating macros that take data from one sheet (as an entry form), copys the data, and pastes it in another sheet (as the data base). Then, a command to clear entries.

My daily use sheet has PLENTY of that action. It's basic coding for creating a data entry dashboard when you're using Excel to act as Access, a database program.

The link provided by Theslyf0x is an excellent introduction to creating your own macros through "recording" the actions you take. Since you're adding data to an ever growing table, you need to alter the target cells for each successive use of the macro. That'll require a bit of code to find the next available row to paste your data, and a bit to do the actual pasting. Finally, a bit will be needed to reset and clear your dashboard for the next use.

I'll post below some snippets of code that I use on my sheets and describe how they function so you might be able to bend them to your will. Alternately, I'm happy to spend an hour or two to work on your sheet, if you can provide a copy.

Find next open row

I'm going to assume that your're filing out a table from top to bottom instead of left to right, and that the second column, "B", has data. Also, the sheet that you're copying to is named "Data"

Dim lastrow As Long    
Dim wks As Worksheet

Set wks = Sheets("Data")
lastrow = wks.Range("B:B").Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

This bit of code find the last used row in column B, from top down, and assigns it to variable "lastrow" by extension, the first unused row would be lastrow + 1. Also, I set a variable for the Data worksheet to easily let the macro know to perform some of these actions on a DIFFERENT sheet than then one that is active when you fire up the macro, your dashboard sheet.

"Copy" data from one sheet to the next

I'm going to assume for simplicity that the info you're going to be entering will be entered A2:E2 for this example. that's five pieces of data in a horizontal row. I'll also assume that the Data tab that you're copying it to uses A:E as well, in the same order, from row 2 down to infinity. Here's the code to copy the FIRST cell, A2 to the first Data table cell, A2:

Dim wks As Worksheet

Set wks = Sheets("Data")
wks.Cells(2, 1).Value = Cells(2,1).Value

No copy, no paste, the Data sheet cell just takes the same value as the original cell. The Cell function navigates first down rows, then over columns, so A1 would be Cell(1,1). As such, if we want to add in the lastrow variable we used above, the code becomes:

wks.Cells(lastrow+1, 1).Value = Cells(2,1).Value

The input cell (Cells(2, 1)) never changes. The destination cell will lower to the last occupied row plus one.

move a row of data

we've successfully copied one cell, let's do it repeatedly. The easiest way would be to just perform the steps again:

wks.Cells(lastrow+1, 1).Value = Cells(2,1).Value
wks.Cells(lastrow+1, 2).Value = Cells(2,2).Value
wks.Cells(lastrow+1, 3).Value = Cells(2,3).Value
wks.Cells(lastrow+1, 4).Value = Cells(2,4).Value
wks.Cells(lastrow+1, 5).Value = Cells(2,5).Value

and we'd be done with your theoretical 5 input cells. If you have to do this 100 times, be smart about it and loop it:

For i = 1 To 5
    wks.Cells(lastrow + 1, i).Value = Cells(2, i).Value
Next i

This will loop the code to continue from column to column as many times as there are values for i (1 to 5) have a row of 10 values to move? loop it For i=1 to 10

The Cells function makes it pretty easy to customize the placement of where things go. want to start the table at D2 instead of A2? Just add 2 to the second Cell value: wks.Cells(lastrow + 1, 2+i).

Cleaning up

since the input data is in a nice little row, the code for deleting the contents is pretty simple:

Range("A2:A5").ClearContents

that's it.

This makes your final macro:

Sub capturedata()

Dim wks As Worksheet

Set wks = Sheets("Data")

lastrow = wks.Range("B:B").Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

For i = 1 To 5
    wks.Cells(lastrow + 1, i).Value = Cells(2, i).Value
Next i

Range("A2:A5").ClearContents

End Sub

Again, I'm happy to work individually on your sheet and its unique situation. PM me as needed. This code is a pretty good start and easy to scale up.

/r/excel Thread