Unable to Filldown from Date Variable in VBA

swl681

New Member
Joined
Sep 15, 2011
Messages
8
My goal is to find the most recent date in column A (the date in column A is determined by a formula) and filldown one row from the most recent date in column A through column T.


I am able to locate the most recent date in column A utilizing


Max_date = Application.WorksheetFunction.Max(Columns("A"))


but when I try to identify it in a range I am unsuccessful.


Below is the total of failing code:


Sub Find_Date()


Dim Max_date As Date


Max_date = Application.WorksheetFunction.Max(Columns("A"))


Worksheets("Sheet1").Range("A" & Max_date).End(xlDown).FillDown


End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
You want to fill down just one row? Try like this on a copy of your workbook!!

Code:
Max_date = Application.WorksheetFunction.Max(Columns("A"))
Match_Max = Application.Match(Max_date, Columns("A"), 0)

If Not IsError(Match_Max) Then Range(Cells(Match_Max, 1), Cells(Match_Max + 1, 20)).FillDown
 
Upvote 0
That worked perfectly, many thanks.

If you have time, can you walk me through the If Not logic you used?

Either way many thanks from a VBA noob!
 
Upvote 0

Forum statistics

Threads
1,215,417
Messages
6,124,791
Members
449,188
Latest member
Hoffk036

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top