Ottsel
Board Regular
- Joined
- Jun 4, 2022
- Messages
- 167
- Office Version
- 365
- Platform
- Windows
Trying to use the Max function within VBA to find the latest date within an array of data, but I don't want to result in a formula, but rather an actual number (date in this case).
Currently I put this together, but I'm trying to go with a method that doesn't require so much time for it to run and or output the result(s).
The idea is to find the latest date and put the result in R30.
I attempted to research the proper structure to pull this off, but probably wasn't using the correct phrasing. Any help or tips would be greatly appreciated!
Currently I put this together, but I'm trying to go with a method that doesn't require so much time for it to run and or output the result(s).
The idea is to find the latest date and put the result in R30.
VBA Code:
Sub test()
Sheets("Sheet2").Range("R30").Value = "=MAX(Sheet2!E32:E37)"
With Sheets("Sheet2").Range("R30")
.Value = Sheets("Sheet2").Range("R30").Value2
.NumberFormat = "mm/dd/yy;@"
End With
End Sub
I attempted to research the proper structure to pull this off, but probably wasn't using the correct phrasing. Any help or tips would be greatly appreciated!