Last record

  • Thread starter Thread starter bijan
  • Start date Start date
B

bijan

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
 
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
 

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