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

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
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,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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