+ Reply to Thread
Results 1 to 3 of 3

How do I place formula in cell using VBA with formula actually being placed in cell

  1. #1
    Forum Contributor
    Join Date
    09-11-2014
    Location
    Eugene, Oregon
    MS-Off Ver
    MS EXCEL 2010
    Posts
    208

    How do I place formula in cell using VBA with formula actually being placed in cell

    I have been trying the following code to place a formula in a cell

    Please Login or Register  to view this content.
    This is just a test of my code to see if it worked which it didn't. What I am trying to do is place a formula in the range A20:A56 where each formula in each row will look at the adjacent cells in columns E:U if any of the cells in that row range is greater than or less than zero put "True" otherwise if all cells in that range equal zero put "False".

    Currently if I paste this formula in cell A22 it works and returns a "False" because none of the values in the range E22:U22 contain a number greater than or less than zero but if I run the code instead, it places "True" in the cell regardless of the values in the range all being zero. secondly, when I run the code it doesn't actually place the formula in the cell it places the solution in the cell and I was hoping to get the formula although if I can just get the formula to work that would be fine. Not sure if it matters but there are formulas in the range E:U that pull in a $value from a data set using a "Sumifs" formula. My end goal is, I'm just looking to place the above formula in the range of cells ("A20:A56") that looks at the adjacent "E:U" range and if any value within that range either contains a dollar value greater than $0 or less than $0 just put "True" but if all values within that range are all $0 put "False".

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    MS Office Excel 2007
    Posts
    6,952

    Re: How do I place formula in cell using VBA with formula actually being placed in cell

    Try

    Please Login or Register  to view this content.
    or you might need double double quotes

    Please Login or Register  to view this content.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Contributor
    Join Date
    09-11-2014
    Location
    Eugene, Oregon
    MS-Off Ver
    MS EXCEL 2010
    Posts
    208

    Re: How do I place formula in cell using VBA with formula actually being placed in cell

    Thanks Special-K! It was the double quotes.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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