vb code for macro to not execute when blank cell encountered.
Hi
in C9 user enters a customer number e.g. 124578 (mandatory must enter number)
then in C10 user enters a date 16/3/2010 (mandatory must enter date)
and from H20:H200 the user fails to enter required qty e.g. 2,5 or 100.
(mandatory, user must enter quantity in atleast one cell between this range).
and runs a macro
when this happens the macro must fail.
I want to stop the macro from being executed if all above 3 criterias are not fulfilled.
Can you please advise asap
Many thanks
Re: vb code for macro to not execute when blank cell encountered.
what is the difference between this question and your previous one?
1 Attachment(s)
Re: vb code for macro to not execute when blank cell encountered.
the difference is after i modified the code i found that i had to enter a value in all rows in the h column until 200. what i want is in that range H20 to H200 even if i enter one value in either one of the rows then that is acceptable.
have attached a mock file with code for your reference.
thanks again.
Re: vb code for macro to not execute when blank cell encountered.
vb Code:
dim notallempty as boolean, c as range
for each c in range("o3:0333")
if not isempty(c) then notallempty = true: exit for
next
if not isempty(range("c9")) and not isempty(range("c10") and notallempty then
else
exit sub
end if
change ranges to suit, i didn't test, but looks right
Re: vb code for macro to not execute when blank cell encountered.
thank but it's falling off at no. 5 ( the code is appearing in red) and am trying to check why but so far cudn't figure it out.
Re: vb code for macro to not execute when blank cell encountered.
needs extra closing bracket after c10"