Thread
:
Using the And formula in a VBA macro
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett[_4_]
external usenet poster
Posts: 2,337
Using the And formula in a VBA macro
one simple way. There is probably a better way if we knew your code and the
full parameters of your need.
if cond1 then activecell.offset(1,2)=text1
if cond2 then activecell.offset(1,2)=text2
--
Don Guillett
SalesAid Software
"Corinne R" wrote in message
om...
I'm learning VBA and have got stuck!
I have a spreadsheet with 7 columns of information. I want to work
down the spreadsheet, testing 4 criteria. The critera look at the
columns and test to see if they apply. I can use the And function to
return a true or false value.
I want to use VBA to say that if a particular condition applies then
put 'text1' in the cell to the right, if not test the next condition
and if that is true then put 'text2' in the cell to the right, if not
test the next condition.
I've recorded the macro and am using an activecell.formula = approach.
I just can't get it to run in an Else If way. The first test runs
but the second doesn't. I can't put an if statement before the
activecell.formula.
Has anyone got any ideas on how to overcome this?
Much appreciated
Corinne R
Reply With Quote
Don Guillett[_4_]
View Public Profile
Find all posts by Don Guillett[_4_]