Comparing dates from column values

tomleitch

Board Regular
Joined
Jan 3, 2012
Messages
189
Hi - wondering if anyone can help....



I am trying to compare column values from a defined cell with a date in to see if they are equal or in front of the defined date.

I have the following code:

Code:
Dim cl As Range
Dim lrow As Long
Dim Srchrng As Range
Dim Fstart As Date
Dim Fend As Date

Fstart = Sheets("SETTINGS").Range("W2").Value
Fend = (Fstart + 14)

MsgBox Fstart
MsgBox Fend


lrow = Sheets("SHEET 1").Cells(Rows.Count, 1).End(xlUp).Row
Set Srchrng = Sheets("SHEET 1").Range(Cells(10, PLANWST), Sheets("SHEET 1").Cells(lrow, PLANWST))
For Each cl In Srchrng
If Not IsEmpty(cl) And cl.Value >= Fstart Then MsgBox "Found"
   Next cl

Thanks
TomL
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
To start with you need to qualify the first Cells with the sheet name...

Code:
Set Srchrng = Sheets("SHEET 1").Range([COLOR="#FF0000"]Sheets("SHEET 1").[/COLOR]Cells(10, PLANWST), Sheets("SHEET 1").Cells(lrow, PLANWST))

Other than that you need to explain your issue and tell us about any error messages you get.

Also are you also sure that is how your sheet name appears?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,085
Messages
6,128,733
Members
449,465
Latest member
TAKLAM

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