Getting the last line of data in a data sheet.

S

sungen99

I have a running list of data in a worksheet2 where column B contains
the date of the data.

What I would like is a macro that will find the last line of data in
worksheet2, get the date in that last line column B and plant it on
worksheet1 A1.

Thanks very much,
Ken
 
N

Norman Jones

Hi Ken,

Try:

'=============>>
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As range

Set WB = ActiveWorkbook '<<==== CHANGE
Set SH = WB.Sheets("Sheet2")
Set rng = SH.Cells(Rows.Count, "B").End(xlUp)

rng.Copy Destination:=WB.Sheets("Sheet1").range("A1")

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

Top