sparky2205
Active Member
- Joined
- Feb 6, 2013
- Messages
- 481
- Office Version
- 365
- 2016
- Platform
- Windows
Folks,
I'm trying to enter a dynamic COUNTIF formula in a cell using vba. I don't want the result of the formula. I want to enter the formula itself.
This is the basis of what I've been playing around with:
This gives me the "Expected: end of statement" error.
I've tried a few variations, most of which return the error above, one of which returned an "invalid character" error.
I've successfully inserted formulas previously but the COUNTIF is causing me problems. Or I'm just doing something silly.
I'm trying to enter a dynamic COUNTIF formula in a cell using vba. I don't want the result of the formula. I want to enter the formula itself.
This is the basis of what I've been playing around with:
Excel Formula:
Range("F4").Formula2="CountIf($B$9:$B$"&LastRow&"),"<>n/a")"
I've tried a few variations, most of which return the error above, one of which returned an "invalid character" error.
I've successfully inserted formulas previously but the COUNTIF is causing me problems. Or I'm just doing something silly.