Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 11th, 2007, 06:29 AM
Authorized User
Join Date: Apr 2007
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Excel formula not working in vba

I am using the formula in excel which i want to use in vba. The formula in excel is :- =IF(C3=0,"Nil Forecast",IF(E3=0,"Nil Sale",F3/C3)).This formula fails when used in excel vba. Please suggest how can i use the same in vba or what corrections i have to do to run it sucessfully.

Old December 11th, 2007, 08:05 AM
Friend of Wrox
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts

Try using evaluate yogesh

s = Evaluate("IF(C3=0,""Nil Forecast"",IF(E3=0,""Nil Sale"",F3/C3))")




VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Old December 12th, 2007, 02:27 AM
Authorized User
Join Date: Apr 2007
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts

The Evaluate("IF(C3=0,""Nil Forecast"",IF(E3=0,""Nil Sale"",F3/C3))")
statement is giving wrong result.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Translating WorkSheet Formula in VBA AndyL Beginning VB 6 2 June 11th, 2008 04:13 AM
Excel formula not working in VBA yogeshyl Excel VBA 2 July 19th, 2007 03:57 AM
Excel vba query not working, pls help me. kavisundar SQL Language 0 May 16th, 2007 10:14 AM
why this formula pssing is not working? ceema Crystal Reports 1 April 12th, 2006 06:15 AM
Problems introducing a formula using VBA mariona_cid Excel VBA 0 June 1st, 2004 07:01 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.