what is the syntax error below
If Ucase(aSheet.Cells(4."e")).value = "ABCD" AND if aSheet.Cells(i,"d") <> "" And dic.Exists((aSheet.Cells(i,"d")) then
MsgBox ("ABCD ORG NOT CONSISTENT" )
Exit Sub
End if
Printable View
what is the syntax error below
If Ucase(aSheet.Cells(4."e")).value = "ABCD" AND if aSheet.Cells(i,"d") <> "" And dic.Exists((aSheet.Cells(i,"d")) then
MsgBox ("ABCD ORG NOT CONSISTENT" )
Exit Sub
End if
a couple of things I see. There is a . instead of a , between the 4 and "e" in the first cell reference.
Also you should reference the columns by number and not character so you'd use
Code:If Ucase(aSheet.Cells(4, 5)).value = "ABCD" AND if aSheet.Cells(i,4) <> "" And dic.Exists((aSheet.Cells(i,4)) then
MsgBox ("ABCD ORG NOT CONSISTENT" )
Exit Sub
Still it shows syntax error
If Ucase(aSheet.Cells(4."e")).value = "ABCD" AND aSheet.Cells(i,"d") <> "" And dic.Exists((aSheet.Cells(i,"d")) then
don't need 2 ifs
westconn
actaully i want
for example if the d cell has
par
par
car
i need only take par and par only if it is anythign other than par
it comes mSG BOX NOT CONSTRAINT
what i did the above is that one is right? please let me know
thanks
i don't believe you need to check if cells(i,"d") is both <> "" and dic.exists, if it was "" then it can not dic.exists, whatever dic.exists is
if you are not sure why it is returning false you need to evaluate both parts separately to fond out what the problem is
Quote:
Originally Posted by india123
Hi there...
I believe apart from the .cells(R,C).value number issue the problem with the syntax is that you did not nest the second if statement.
If Ucase(aSheet.Cells(4."e")).value = "ABCD" then
if aSheet.Cells(i,"d") <> "" And dic.Exists((aSheet.Cells(i,"d")) then
MsgBox ("ABCD ORG NOT CONSISTENT" )
Exit Sub
end if
End if
cheers