+ Reply to Thread
Results 1 to 7 of 7

Evaluate syntax

  1. #1
    Registered User
    Join Date
    08-25-2012
    Location
    boston,ma
    MS-Off Ver
    Excel 2010
    Posts
    4

    Evaluate syntax

    I have created a named range referring to a column of numbers and want to create a new array of 1's and 0's in order to isolate a cell containing particular state abbreviations(.ie. make that cell a one when all the others are 0's. I am also trying to do this using the evaluate function:

    Please Login or Register  to view this content.
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

    This returns an array of all zero's even though it should return about 60 1's (states equal to "MA"). I think that the problem is with the use of the double quotations, but I can't get it to work after trying several combinations of quotes.

    Any help would be appreciated.
    Last edited by 6StringJazzer; 08-29-2017 at 09:39 AM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,573

    Re: Evaluate syntax

    Try change to
    Please Login or Register  to view this content.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Evaluate syntax

    Assign the formula to a string variable, then print it to the Immediate window. If it's correct, you should be able to copy it directly into a cell and have it work. If not, start fixin'.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Valued Forum Contributor
    Join Date
    03-16-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    371

    Re: Evaluate syntax

    Can you not just do this inside VBA instead of using Excel formulas inside VBA?

    E.g.
    Please Login or Register  to view this content.
    Design everything to be as simple as possible, but no simpler.

  5. #5
    Registered User
    Join Date
    08-25-2012
    Location
    boston,ma
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Evaluate syntax

    I found the problem. I had to strip the quotes from the state variable:

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor
    Join Date
    03-16-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    371

    Re: Evaluate syntax

    I think it was Michael Jordan who once said something like "you can practise a thousand shots a day, but if you're using a bad technique all you get good at is shooting a bad ball".

    I still think Application.Evaluate is a bad way achieve what you are trying to achieve. *shrugs*

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Evaluate syntax

    Quote Originally Posted by kcaisaacs View Post
    I found the problem. I had to strip the quotes from the state variable:

    Please Login or Register  to view this content.
    Hi,

    That can't have been the problem since there are no quotes within the variable and hence that code achieves nothing at all. I suspect that Jindon's answer was what you actually needed but you just happened to activate the right sheet while testing again.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Evaluate in VBA
    By mklindquist0815 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-07-2016, 01:56 PM
  2. Syntax error using Evaluate
    By chiidzzz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-28-2013, 05:04 PM
  3. [SOLVED] Using Evaluate() in an Array
    By blueiris8 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2012, 03:01 PM
  4. Evaluate Formula Syntax in VBA code
    By NBVC in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-03-2010, 04:19 PM
  5. using evaluate with today()
    By dme in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-30-2006, 04:56 AM
  6. what should be syntax for evaluate Indirect
    By srinu1264 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-06-2006, 09:30 AM
  7. evaluate HYPERLINK()
    By rabbit ribbit in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-02-2005, 09:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1