Coping values to the next empty row

  • Thread starter Thread starter Richard James
  • Start date Start date
R

Richard James

I need code that will paste two separate values in one
worksheet in the next available row. One value in
column "A" and the other value in column "B". The code
would paste the values as the user shuts down the program
in the same row of a specified worksheet. I need this to
collect a series of values from separate users who use
this program at different times of the day.

Thanks in advance,
Rich
 
I assume that you have no problems coping but wish this:

The following pair would add values to the row beneath the bottom of the
sheet. If you want to put it somewhere higher, that will depend on the
design of your application, likely involving xlDown or such.

dim lLastRow as long
lLastRow = ActiveCell.SpecialCells(xlLastCell).Row
Range("A1").Offset(lLastRow, 0)="1st"
Range("A1").Offset(lLastRow, 1)="2nd"

Some considerations, best investigated by typing Control-End on your
sheet:
when sheet already extends to row 65536
when sheet has had rows deleted, so that the bottom of the sheet is
artificially "low"
when sheet has cells with formats but no values, so that the bottom is
artificially "low"
 
Back
Top