ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   if statement with date format (https://www.excelbanter.com/excel-discussion-misc-queries/194411-if-statement-date-format.html)

orquidea

if statement with date format
 
Hi All:

I have the statement below were "Tue" is in date format. That's is the
reason the macro doesn't read this field.
If ActiveCell.Offset(0, -10) Like "Tue*" And ActiveCell.Offset(0, -12) Like
"MB*" Then
How could I write this stamentent so that it works?

Thanks in advance for your help.

Orquidea

Mike H

if statement with date format
 
Hi,

If it's a corrrectly formatted date then you can use weekday

If Weekday(ActiveCell.Offset(0, -10) = 3) And ActiveCell.Offset(0, -12) Like
"MB*" Then

Mike

"orquidea" wrote:

Hi All:

I have the statement below were "Tue" is in date format. That's is the
reason the macro doesn't read this field.
If ActiveCell.Offset(0, -10) Like "Tue*" And ActiveCell.Offset(0, -12) Like
"MB*" Then
How could I write this stamentent so that it works?

Thanks in advance for your help.

Orquidea


orquidea

if statement with date format
 
Mike:

I have the correct date format but when the if statement evaluates the
condition, it is considering all days as 3. Would be any extra format I have
to do.

Thanks,
Orquidea

"Mike H" wrote:

Hi,

If it's a corrrectly formatted date then you can use weekday

If Weekday(ActiveCell.Offset(0, -10) = 3) And ActiveCell.Offset(0, -12) Like
"MB*" Then

Mike

"orquidea" wrote:

Hi All:

I have the statement below were "Tue" is in date format. That's is the
reason the macro doesn't read this field.
If ActiveCell.Offset(0, -10) Like "Tue*" And ActiveCell.Offset(0, -12) Like
"MB*" Then
How could I write this stamentent so that it works?

Thanks in advance for your help.

Orquidea



All times are GMT +1. The time now is 01:30 AM.

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