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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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,214,787
Messages
6,121,558
Members
449,038
Latest member
Guest1337

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