printing from Excel data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Anthony said:
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
 

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

Back
Top