+ Reply to Thread
Results 1 to 9 of 9

VB function interfere with Excel refresh

  1. #1
    Registered User
    Join Date
    09-21-2011
    Location
    florida
    MS-Off Ver
    Excel 2007
    Posts
    14

    VB function interfere with Excel refresh

    Hello folks,

    I have a small function that creates a filter criteria for a report that links through a access query.When I do a refresh to update values on the report with the new values stored in access database, it throws an exception "Type Mismatch" on the VB function. Below is the function:

    Please Login or Register  to view this content.
    So, when I do a refresh from Data tab -> Refresh, the function should not throw an exception. Please advise the resolution.

    The error is thown on :
    Please Login or Register  to view this content.
    Thanks for your response.
    Last edited by ame; 02-09-2012 at 03:20 PM.

  2. #2
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VB function interfere with Excel refresh

    On the assumption that your code is supposed to be testing if C2 or D2 change (though that is not what it actually does now)

    Please Login or Register  to view this content.
    Good luck.

  3. #3
    Registered User
    Join Date
    09-21-2011
    Location
    florida
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VB function interfere with Excel refresh

    Thanks..that worked

  4. #4
    Registered User
    Join Date
    09-21-2011
    Location
    florida
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VB function interfere with Excel refresh

    I understand you know this stuff really well, Please help with another requirement.
    If you see above, Cell referece "D2" checks for a date value from a pop up calendar i have on that cell. Currently, it filters only for that selected value. However, I need it to display all values "LESS" than the selected date value. Please advise,
    Example: If the user selects 1st february 2012 on "D2", the filter should display all rows with date BEFORE 1st february 2012, currently it gives all rows with the date as 1st february 2012.

    Thanks for your help

  5. #5
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VB function interfere with Excel refresh

    I would have the popup calendar actually enter the date in a different cell (eg D3) and then use ="<"&D3 in D2 for example as the actual filter. You will need to adjust the code here to monitor the new linked cell rather than D2.

  6. #6
    Registered User
    Join Date
    09-21-2011
    Location
    florida
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VB function interfere with Excel refresh

    Regret, I couldnt quite understand the change you propose to make in excel, Please elaborate with an example

  7. #7
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VB function interfere with Excel refresh

    I did give an example. Instead of linking your calendar to cell D2, link it to D3, and link D2 to D3 using the formula I suggested.
    You then need to change the code to watch D3 rather than D2.

    Either that or use an autofilter instead which is probably simpler.

    Hard to be any more specific without a workbook.

  8. #8
    Registered User
    Join Date
    09-21-2011
    Location
    florida
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VB function interfere with Excel refresh

    Works great..Thank You..Solved

  9. #9
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VB function interfere with Excel refresh

    Glad to help.

    From the FAQ:

    To mark your thread solved do the following:
    - Go to the first post
    - Click edit
    - Click Advance
    - Just below the word "Title:" you will see a dropdown with the word No prefix.
    - Change to Solve
    - Click Save

+ 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