Is there a way to change the cell notation that is generated by VB.
I'm creating some nested if formulas something along the lines of:
activecell.offset(0,-1).formula = "=if(" & activecell.address & "> 0," & activecell.offset(0,1).address & "," & activecell.offset(0,2).address & ""
Everything seems to work ok with the following being generated in cell a1
=if($B$1>0,$C$1,$D$1)
Once i've nested this a couple of times to come up with a really ugly "if" statement, it still seems to work fine. But when I start to move around columns, the links to the cells seems to be broken. If I rewrite my code so that it generates:
=if(B1>0,C1,D1)
the links seem to be maintained. Off course once I have rewritten my code to handle this, I end up with hard coded columns in my code:
activecell.offset(0,-1).formula = "=if(B" & activecell.row & "> 0,C" & activecell.row & ",D" & activecell.row & ""
I would like to keep the flexibility of using the address property, but get the dollar signs out of the address of a cell.
Sorry if some of the code doesn't work...haven't done a syntax check. Just writting off the top of my head.
Thanks
rekclaw
I'm creating some nested if formulas something along the lines of:
activecell.offset(0,-1).formula = "=if(" & activecell.address & "> 0," & activecell.offset(0,1).address & "," & activecell.offset(0,2).address & ""
Everything seems to work ok with the following being generated in cell a1
=if($B$1>0,$C$1,$D$1)
Once i've nested this a couple of times to come up with a really ugly "if" statement, it still seems to work fine. But when I start to move around columns, the links to the cells seems to be broken. If I rewrite my code so that it generates:
=if(B1>0,C1,D1)
the links seem to be maintained. Off course once I have rewritten my code to handle this, I end up with hard coded columns in my code:
activecell.offset(0,-1).formula = "=if(B" & activecell.row & "> 0,C" & activecell.row & ",D" & activecell.row & ""
I would like to keep the flexibility of using the address property, but get the dollar signs out of the address of a cell.
Sorry if some of the code doesn't work...haven't done a syntax check. Just writting off the top of my head.
Thanks
rekclaw