![]() |
Compare date in cell to date in Textbox
I am having trouble trying to compare dates that are in a worksheet cell
against a date placed in a Textbox. Here's the code: If Cells(Drow, 5).Value < TextStart.Value And Not (Left(Cells(Drow, 10).Value, 1) Like "[D]") Then Rows(Drow).Select Selection.Interior.ColorIndex = 34 End If The problem is that it changes all the cells to colorindex 34. I need it to only change the colorindex of those rows that are prior to the textStart.value Thanks in advance |
Compare date in cell to date in Textbox
Try this .... assuming TextStart is a text string which needs to be converted
to a date format for the comparison with your Cell (presumably formtted s Date). HTH If Cells(Drow, 5).Value < Datevalue(TextStart.Value) And Not (Left(Cells(Drow, "asmenut" wrote: I am having trouble trying to compare dates that are in a worksheet cell against a date placed in a Textbox. Here's the code: If Cells(Drow, 5).Value < TextStart.Value And Not (Left(Cells(Drow, 10).Value, 1) Like "[D]") Then Rows(Drow).Select Selection.Interior.ColorIndex = 34 End If The problem is that it changes all the cells to colorindex 34. I need it to only change the colorindex of those rows that are prior to the textStart.value Thanks in advance |
Compare date in cell to date in Textbox
Thanks Topper,
Must of had a loss of brain. I should have caught this. I officially demote myself from developer to idiot. Thanks again for the help. "Toppers" wrote: Try this .... assuming TextStart is a text string which needs to be converted to a date format for the comparison with your Cell (presumably formtted s Date). HTH If Cells(Drow, 5).Value < Datevalue(TextStart.Value) And Not (Left(Cells(Drow, "asmenut" wrote: I am having trouble trying to compare dates that are in a worksheet cell against a date placed in a Textbox. Here's the code: If Cells(Drow, 5).Value < TextStart.Value And Not (Left(Cells(Drow, 10).Value, 1) Like "[D]") Then Rows(Drow).Select Selection.Interior.ColorIndex = 34 End If The problem is that it changes all the cells to colorindex 34. I need it to only change the colorindex of those rows that are prior to the textStart.value Thanks in advance |
All times are GMT +1. The time now is 05:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com