ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Last record (https://www.excelbanter.com/excel-programming/421271-last-record.html)

bijan

Last record
 
Hi all,
I connect to a database and receive data, my data is sorted and therefor the
maximum date must be in the last record
1.How can I capture the maximum date that exist in column E ?
2. and how can I put this value in "F10"(at the beginig of the file) and
auto fill it to the end of the file?
Thanks in advance
Bijan

Mike H

Last record
 
Hi,

If column A is dates you don't need to specifically find the last row you
can get the latest date with

Dim Mydate As Date
Range("F10") = WorksheetFunction.Max(Range("A:A"))

If you want to find the value from the last row you can use

lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("F10") = Range("A" & lastrow).Value

Mike


"bijan" wrote:

Hi all,
I connect to a database and receive data, my data is sorted and therefor the
maximum date must be in the last record
1.How can I capture the maximum date that exist in column E ?
2. and how can I put this value in "F10"(at the beginig of the file) and
auto fill it to the end of the file?
Thanks in advance
Bijan



All times are GMT +1. The time now is 09:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com