ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finds date but won't change cell (https://www.excelbanter.com/excel-programming/375537-finds-date-but-wont-change-cell.html)

Esau[_3_]

Finds date but won't change cell
 
Can some one tell me why it won't change cell H12
It finds the date

-- Range("F5").Select
Cells.Find(What:="3/1/2006", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
If ActiveCell = 3 / 1 / 2006 Then
Range("H12").Value = 1
Esau

Carim

Finds date but won't change cell
 
Hi Esau,

just modify the activecell line ...

If ActiveCell.Value = "3 /1/2006" Then

HTH
Carim


Charles Chickering

Finds date but won't change cell
 
Because Excel thinks you mean 3 divided by 1 divided by 2006
Try this instead:
If ActiveCell = DateValue("3/1/2006") Then

--
Charles Chickering

"A good example is twice the value of good advice."


"Esau" wrote:

Can some one tell me why it won't change cell H12
It finds the date

-- Range("F5").Select
Cells.Find(What:="3/1/2006", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
If ActiveCell = 3 / 1 / 2006 Then
Range("H12").Value = 1
Esau


Jim Thomlinson

Finds date but won't change cell
 
"3/1/2006" is text, but 3/1/2006 is 3 divided by 1 divided by 2006. Probably
not what you intended...
--
HTH...

Jim Thomlinson


"Esau" wrote:

Can some one tell me why it won't change cell H12
It finds the date

-- Range("F5").Select
Cells.Find(What:="3/1/2006", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
If ActiveCell = 3 / 1 / 2006 Then
Range("H12").Value = 1
Esau


Esau[_3_]

Finds date but won't change cell
 
Thanks Worked great I had just about gave up and was looking for some other way

Thanks again
--
Esau


"Charles Chickering" wrote:

Because Excel thinks you mean 3 divided by 1 divided by 2006
Try this instead:
If ActiveCell = DateValue("3/1/2006") Then

--
Charles Chickering

"A good example is twice the value of good advice."


"Esau" wrote:

Can some one tell me why it won't change cell H12
It finds the date

-- Range("F5").Select
Cells.Find(What:="3/1/2006", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
If ActiveCell = 3 / 1 / 2006 Then
Range("H12").Value = 1
Esau



All times are GMT +1. The time now is 04:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com