Okay, if Sheet2!A2 contains a date serial and you want to check whether the month part is found in the
character string in Sheet1!A1, try this:-
Code:
With ThisWorkbook
If InStr(.Sheets("Dashboard").Range("O8").Value, Format(.Sheets("Quotas").Range("A2").Value, "mmm")) > 0 Then
Response = MsgBox("this is the current month Quota Sheet, do you want to continue with replacement?", vbQuestion + _
vbYesNo)
If Response = vbYes Then
If Sheet2!A2 contains a date serial and you want to check whether the month part is the same as the month part of the
date serial in Sheet1!A1, try this:-
Code:
With ThisWorkbook
If Format(.Sheets("Dashboard").Range("O8").Value, "mmm") = Format(.Sheets("Quotas").Range("A2").Value, "mmm") Then
Response = MsgBox("this is the current month Quota Sheet, do you want to continue with replacement?", vbQuestion + _
vbYesNo)
If Response = vbYes Then
You have to ignore what the cells are displayed as - you can't compare these because they're not the actual values in the cell. You have to consider what the actual values in the cells are and compare thos in the most appropriate way.