View Single Post
  #2   Report Post  
SteveF
 
Posts: n/a
Default

Anthony wrote:
Hi,
Can anybody suggest some VB code that will allow me to select the

LAST row
of data entered into a worksheet and print just this info, example


SMITH 123 JONES 456
JONES 897 SMITH 019
PAUL 876 PHIL 124

So I wish to select the last row of data ie PAUL 876 PHIL 124 and

print
this in a separate form already produced on a separate sheet

Hope you can help

regards



Assuming your data is in columns A-D of sheet1 and your "separate form"
starts
in B2 of Sheet2 then this code should work:

Sub printlast()
lastrow = Sheets("Sheet1").Range("a65536").End(xlUp).Row
Set fromrange = Sheets("sheet1").Range(Cells(lastrow, 1), _
Cells(lastrow, 4))
fromrange.Copy Sheets("sheet2").Range("b2")
End Sub