Thread: Macros/VBA
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Macros/VBA

You could put your code inside a worksheet_change event.
Right click on the sheet tabview codein the left window select
worksheetin the right window select worksheet_change
insert your code


"mika." wrote in message
...
Hi Don,

The problem is this -- is there a way, once a1 or a2 or
a3 is updated, that I can get a4 to automatically update
using VBA -- in a simimlar way to how the dependent cell
is automatically updated if it were written as a function
like =(OR(AND...)) etc.?

Thanks.
-----Original Message-----
code would look something like
If [a1]="b" and [a2]="M" and [a3]="F" then [a4]=1
If [a1]="b" and [a2]="M" and [a3]="O" then [a4]=2
If [a1]="b" and [a2]="M" and [a3]="T" then [a4]=2
etc
these are case sensetive so you may need
if ucase([a1])="B" etc

or a1=b and a2=nM and a3=F, a4=3
or a1=b and a2=nm and a3=O, a4=4
or a1=b and a2=nm and a3=T, a4=5
or a1=s and a3=F, a4=6
or a1=s and a3=O, a4=7
or a1=s and a3=T, a4=8
or a1=a and a2=M and a3=F, a4=7
or a1=a and a2=m and a3=O, a4=8or a1=a and a2=m and

a3=T,
a4=8




"mika." wrote in message
...
Hello,

The if statement (in pseudocode) would be something

like
this:
If a1=b and a2=M and a3=F, a4=1
or a1=b and a2=m and a3=O, a4=2
or a1=b and a2=m and a3=T, a4=2
or a1=b and a2=nM and a3=F, a4=3
or a1=b and a2=nm and a3=O, a4=4
or a1=b and a2=nm and a3=T, a4=5
or a1=s and a3=F, a4=6
or a1=s and a3=O, a4=7
or a1=s and a3=T, a4=8
or a1=a and a2=M and a3=F, a4=7
or a1=a and a2=m and a3=O, a4=8or a1=a and a2=m and

a3=T,
a4=8
...etc. There are 14 statements in total; this is why I
thought it would be easier to use VBA to write the
conditional statement rather than nested =(or
(and...))..etc. Any advice?

Thanks.
-----Original Message-----
Why not tell us the detail. Perhaps it needn't be so
tedious and complex




.