ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   formula using vba does not work .. (https://www.excelbanter.com/excel-discussion-misc-queries/211824-formula-using-vba-does-not-work.html)

[email protected]

formula using vba does not work ..
 
Hi,

In a spreadsheet I insert a very simple formula :

Range("I1").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(A:A,""*"")"
Range("I2").Select

Cell I1 gives an error #NAME?, but when selecting this cell, put
cursor after last char and press enter, the right value appears ! So i
did NOT modify it only place cursor and hit enter ...

Any thoughts ?

-ben

Chip Pearson

formula using vba does not work ..
 
Use ActiveCell.Formula rather than ActiveCell.FormulaR1C1. E.g,.


ActiveCell.Formula = "=COUNTIF(A:A,""*"")"

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 27 Nov 2008 08:06:12 -0800 (PST), wrote:

Range("I1").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(A:A,""*"")"
Range("I2").Select



All times are GMT +1. The time now is 02:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com