code line with two conditions

T

TUNGANA KURMA RAJU

I am not an expert in Vba code.I have a line code
If cell.offset(0,2).value<> _
Worksheets(cell.value).Range("A1").End(xlDown) Then
Set Sh1=nothing
I would like to add one more condition to the above line,apart from the
above condition, If cell.offset(0,1) .value= "EQ" or "BE".How to modify my
line code ?
If my coditions are not met ,the sub should exit by prompting message
"Conditions are not met,Updation not required" with one "ok" button.Where
this message code line has to incorporate.Thanks whole community in advance.
 
J

Joel

I coded exactly what yuo asked for. Can't guarentee it will work.

If (cell.offset(0,2).value<> Worksheets(cell.value).Range("A1").End(xlDown)
_
or (cell.offset(0,1) .value= "EQ") _
or (cell.offset(0,1) .value= "BE") Then
 
T

TUNGANA KURMA RAJU

This gives if any one condition is true,Then ...the asked results will
come.My question is If first condition and any one of second and third
condition is true,then....so. Can it be used with "and" and "or".
What about my 2nd part of my question?.
 
J

Joel

If (cell.offset(0,2).value<> Worksheets(cell.value).Range("A1").End(xlDown)
_
or (cell.offset(0,1) .value= "EQ") _
or (cell.offset(0,1) .value= "BE") Then

'your code

else

msgbox("Conditions are not met,Updation not required")
exit sub

end if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top