Dec 1, 2006
I have written some VBA code that is functional, but yields a formula that is somewhat confusing to the user.
View 9 Replies
I have two string variables called TippityTop and Anchor, both of which refer to specific cell addresses in the R1C1 style.
I attempted to define other variables that reference cells that are offset from TippityTop and Anchor without using the ActiveCell route. Try as I might, I could not produce the cell addresses that I wanted these new variables to reference.
I consulted many Excel Help screens and referred to a book on Excel VBA, but I finally took another route.
I now have:
ActiveCell.FormulaR1C1 = _
"=IF(AND(ISNA(MATCH(RC[-2],OFFSET(" & TippityTop & ",1,-2):OFFSET(" & Anchor & ",-2,-2),0)>0),ROUND(RC[-1],2)0),""DOV not in Treasury"","""")"
The problem is that this code yields this formula in Excel:
=IF(AND(ISNA(MATCH(L587,OFFSET($H$585,1,-2):OFFSET($H$798,-2,-2),0)>0),ROUND(M587,2)0),"DOV not in Treasury","")
Rather than OFFSET($H$585,1,-2):OFFSET($H$798,-2,-2), I would like the formula to say F586:F796, so that the end user can easily understand the logic.