[RESOLVED] find the error in the formula
Hi guys,
I'm getting a Run Time Error 1004, Application-defined or object-defined Error in the formula below.
I've tried almost everything except the right thing, can you find it???
VB Code:
ActiveCell.Offset(0, 4).Formula = "=IF((" & ActiveCell.Offset(0, 2).Address & "<" & ActiveCell.Offset(0, 3).Address & "),"",(" & ActiveCell.Offset(0, 2).Address & " / (" & ActiveCell.Offset(0, 2).Address & "-" & ActiveCell.Offset(0, 3).Address & "))-1)"
thanks
Re: find the error in the formula
Bill
Are you sure you should be using the Address property of the cells and not the Value property?
What exactly are you trying to achieve?
Re: find the error in the formula
Ignore previous posts.
Try this
"=IF((" & ActiveCell.Offset(0, 2).Address & "<" & ActiveCell.Offset(0, 3).Address & "), 0,(" & ActiveCell.Offset(0, 2).Address & " / (" & ActiveCell.Offset(0, 2).Address & "-" & ActiveCell.Offset(0, 3).Address & "))-1)"
I change the TRUE result to a Zero, rather than a "" and it now works.
Re: find the error in the formula
I'm building a template sheet.
Like
ITEM Name Sales TY Sales LY % DIFF
A
B
C
TOTAL
D
E
F
TOTAL
G
H
I
TOTAL
I need the formula to be paste a each TOTAL line
Even by using Value proterty, I'm getting the same error
Thanks
Re: find the error in the formula