+ Reply to Thread
Results 1 to 6 of 6

VBA Formula that require Control+Shift+Enter

  1. #1
    Registered User
    Join Date
    03-05-2009
    Location
    Vail, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    83

    Red face VBA Formula that require Control+Shift+Enter

    VBA automation -
    Excel added the formula - but they all return "Not Found"
    After the VBA automation - I visit each cell, see the formula is correct and then press Control +Shift + Enter; then the correct value displays! Of course, the curly brackets also appear in the formula bar.

    In VBA I tried to use the:
    objXL.ActiveCell.FormulaArray = "=IF(ISERROR(INDEX(PositionDataSell!$T$2:$T$505,MATCH(" & lngContractID & "&" & strQuote & strConCat .....
    The Excel Formula bar for the cell is just empty (blank)

    Using only the Formula property:
    objXL.ActiveCell.Formula = "=IF(ISERROR(INDEX(PositionDataSell!$T$2:$T$505,MATCH(" & lngContractID & "&" & strQuote & strConCat .....

    The correct formula is created in each cell, but...
    Until I visit that cell and use the Control+Shift+Enter - the lookup will not work. It is proof that the right formula is there, without the curly brakcets.

    In Excel - my vba code successfully constructs these formulas:
    In essence: It checks for an error and prints "Not Found" if no match is found in the check. It test for two values in a row - matches them to two columns on a row in another worksheet, and returns a third value for the matches of the same row.

    Please Login or Register  to view this content.
    and, maybe I also need to think of a way to prevent the users from visiting a cell as well
    Maybe I hide the cells with the actual formula and display a cell with the actual value of the cell with a formula?
    Last edited by RxMiller; 05-26-2009 at 02:29 PM. Reason: speling (LOL)

  2. #2
    Registered User
    Join Date
    03-05-2009
    Location
    Vail, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: VBA Formula that require Control+Shift+Enter

    Thought I might use the Macro Recorder to hight light a cell with the formula and click Control+Shift+ enter
    A message that the recorder can't deal with this action appears.
    Sure enough, it just skipped over the action.
    Tried to add the { bracket around the code in the VBA code. Nope, that does not work either.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: VBA Formula that require Control+Shift+Enter

    I'm only dropping in briefly but bear in mind that a VBA Formula Array can not exceed 255 chars in length.

  4. #4
    Registered User
    Join Date
    03-05-2009
    Location
    Vail, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    83

    Talking Re: VBA Formula that require Control+Shift+Enter

    OMG!
    You know, I have this very complex report that uses VBA to program around 3,000 cells formulas, dynamic subtotals and groupings (all different every day).

    Now, after all that great programming my logic fell short here:
    VBA (From Access this time) put a formula into the cell. If I go to the cell and use Control+Shift+Enter, the formula received the curly brackets and worked perfectlly.
    Therefore: the string in the formula could not possibly be over 255 characters.

    Bad Logic on my part.
    My string happened to be 261 characters. (That is over 255 for sure.)
    So, I used search and replace to shorten my very verbose tab name that was used many times in this formula. Now my formula (per VBA point of view) is 241 characters.

    And it all works as expeced.
    That will teach me to "ASSUME".

    And it is not like you didn't mention this to me last week.
    My excuse is: It was a three day weekend - I probably got too much sun while cross-country skiing in Vail. The good wine had absolutely nothing to do with it.

    At the risk of being laughed at, I will post this so others can recgonize the awkward signs of the cell just being blank when using the FormulaArray method since there is no error code or error trap for this issue.

  5. #5
    Registered User
    Join Date
    06-30-2009
    Location
    Southern California, Earth
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: VBA Formula that require Control+Shift+Enter

    Any way to shorten my formula? It works when I do it manually in Excel, but not when I use VBA.

    Please Login or Register  to view this content.
    and I'm using this VBA:
    Please Login or Register  to view this content.
    Thanks in advance, not sure what to do here. :/

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

    Re: VBA Formula that require Control+Shift+Enter

    hoffey, please take a few minutes to re-read the forum rules, and then start your own thread.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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