Select cells in column M, until today's date in column B

Yulyo

Board Regular
Joined
Jul 17, 2017
Messages
94
Hello all,

I need some help and i just can't figure it out by myself. So if you have a few minutes, please help.


I have an excel file with columns from A to X.
On column B, i have some dates, starting from 01.11.2018 (B2)
On column M, i have some values, stating from M2.


Please help me with a macro that can select the values on column M (from a given cell, let's say M5), until today's date is reached in column B.

Thank you in advance.
 
Something else to try
Code:
Sub findToday()
Dim xRng As Range
Set xRng = Columns(2).find([COLOR=#ff0000]CLng[/COLOR](Date), , xlValues, , xlByRows, xlNext)
Range(Cells(5, "M"), Cells(xRng.Row, "M")).Select
End Sub
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hello again and sorry for the late answer.

I'm beginning to think something is wrong with my table, since non of the two variants it's working.
I have a "Runtime error 91 / Object variable or With block variable not set", on "Range(Cells(5, "M"), Cells(xRng.Row, "M")).Select"

Thank you both for your help...

If you have other ideeas, you can find the test file in the link below:
https://drive.google.com/file/d/15u-45bpGRTMAVoreKrGDFk6eu-sQfRmm/view?usp=sharing
 
Upvote 0
Afraid I can't help as the original code I posted using CDate is working on your file on my computer (other than your dates must be fully in view i.e. the cell width has to be wide enough to show the whole date).

Actually you could also try..

Code:
Sub findToday2()
Dim xRng As Range
Set xRng = Columns(2).Find(DateSerial(Year(Date), Month(Date), Day(Date)), , xlValues, , xlByRows, xlNext)
Range(Cells(5, "M"), Cells(xRng.Row, "M")).Select
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,082
Messages
6,128,700
Members
449,464
Latest member
againofsoul

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