Changing formula programmatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using EXCEL 97 and want to change a formula programmatically.

I have two strings which picks up the STARTYEAR & ENDYEAR but when I try to
add them to this formula it causes an error.

=IF(B3="H",(ROUND(VLOOKUP(E2,'AL 2005 -
2006.xls'!STAFF,(MONTH(B2)+2))*H4/40,0)),(IF(B3="D",(ROUND(VLOOKUP(E2,'AL
2005 - 2006.xls'!STAFF_DAYS,(MONTH(B2)+2))*H4/40,0)))))

Can someone help me with a solution please so that the end result is
something on the lines of:

=IF(B3="H",(ROUND(VLOOKUP(E2,'AL STARTYEAR -
ENDYEAR.xls'!STAFF,(MONTH(B2)+2))*H4/40,0)),(IF(B3="D",(ROUND(VLOOKUP(E2,'AL
STARTYEAR - ENDYEAR.xls'!STAFF_DAYS,(MONTH(B2)+2))*H4/40,0)))))

Thanks in advance.
 
Why not just put in the new formula

sub newformula
set frng =range("a2:a22")
with frng
..formula="=yournewformula"
end with
end sub
 

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

Back
Top