Getting the last line of data in a data sheet.
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 -- sungen99 ------------------------------------------------------------------------ sungen99's Profile: http://www.excelforum.com/member.php...fo&userid=9144 View this thread: http://www.excelforum.com/showthread...hreadid=513658 |
Getting the last line of data in a data sheet.
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 '<<============= --- Regards, Norman "sungen99" wrote in message ... 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 -- sungen99 ------------------------------------------------------------------------ sungen99's Profile: http://www.excelforum.com/member.php...fo&userid=9144 View this thread: http://www.excelforum.com/showthread...hreadid=513658 |
All times are GMT +1. The time now is 09:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com