how to find last row of table and copy to another sheet

P

pilgrimm

I have a spreadsheet with 2 tabs. 1 tab is 'input' with a user form
that adds data in columns 'b' to 'i' on another tab called 'PSHCP'.
This works great. the user presses a button on the input sheet and a
user form comes up in which they input the data and it is added to the
next row on the table on the PSHCP tab.

What I would like to do is have that info that they and then added
shown on the 'input' page. It would always keep the last row info
shown so that before one goes in, they can see the last entry info.

I am thinking that I could add this code to the end of the user form
but am not sure. Or I could add it into the code on the spreadsheet
when it opens it would run.

Any help most appreciated.
thx

Mel
 
B

Bernie Deitrick

Mel,

Try something along the lines of:

Dim myRow As Long

With Worksheets("Input")
myRow = .Cells(Rows.Count,1).End(xlUp).Row
..Cells(myRow,1).Value = UserForm1.TextBox1.Text
..Cells(myRow,2).Value = UserForm1.TextBox2.Text
End With

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top