+ Reply to Thread
Results 1 to 4 of 4

Worksheet_Activate works differently in Excel 2007 and 2010

  1. #1
    Registered User
    Join Date
    11-08-2013
    Location
    Rochester NY
    MS-Off Ver
    Excel 2007
    Posts
    1

    Worksheet_Activate works differently in Excel 2007 and 2010

    I created a very simple file to illustrate what I'm seeing. When I activate the BPC worksheet, it triggers the Worksheet_Activate event macro, which displays a message box "BPC". In Excel 2010, the content of the BPC worksheet is displayed before the message box is displayed. When I open the same file in Excel 2007 and activate the BPC worksheet, I get the message box, but the BPC worksheet is blank. Only after I click the OK button on the message box does the content on the BPC worksheet appear.

    Also, I have conditional formatting using a UDF "ShowF" on cells B1:B4. In Excel 2007, after I click OK on the message box, the cell B2 flashes (the background goes from white to black and the text from black to white). When I click the Conditional Formatting button in the Styles area, the flashing stops. The flashing only occurs with conditional formatting that uses the UDF; with other conditional formatting (cell=0, for example), this doesn't happen.

    Any ideas?

    Thanks,
    Richard

    flashing cell problem.xlsm

  2. #2
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    286

    Re: Worksheet_Activate works differently in Excel 2007 and 2010

    No Activate procedure in the spreadsheet that came in...

    Tony

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Worksheet_Activate works differently in Excel 2007 and 2010

    Tony, my download had an activate procedure for MRC and BPC sheets.

    My observations:

    On the "blank until dismiss message box" I entered something in both MRC and Sheet3 sheets. It appears that it isn't showing blank, the display is merely staying on the previously active sheet until the dialog box is dismissed. This seems to be related to calling the UDF from conditional formatting, because when I change to a built in Excel function or a something else, the sheet displays behind the message box.

    I set a breakpoint in the UDF. Interestingly, the code will enter breakmode when the function is called from a spreadsheet cell. It will not enter breakmode when called from conditional formatting. This and the flashing cell seem to be related to some difference in how Excel calls a UDF when called from conditional formatting.

    I added a helper column =(showf(A1)=showf(B1)), then made conditional formatting dependent on this cell being TRUE. It worked as expected without the flashing cell.

    I'm not sure what to think, but there seems to be some difference between calling a UDF from within a spreadsheet cell and calling it from within conditional formatting that creates this hangup. Someone who knows more about the inner workings of Excel may be able to take this further.
    Last edited by MrShorty; 01-03-2014 at 06:40 PM.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    286

    Re: Worksheet_Activate works differently in Excel 2007 and 2010

    I sit corrected! The procedures are indeed where you said they would be

    I've had problems with UDF, and I recall that setting Application.volatile=true helped a bit. If you can get rid of the hyperlinks, and add that line of code (to the start of the uDF), see if that helps.

    Tony

+ 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. excel 2007 formula works great but when open in 2010 returns##
    By lizsantiago07 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-25-2013, 09:25 PM
  2. [SOLVED] Excel macro works in 2010 but nothing happens in 2007
    By onbeillp111 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-16-2013, 08:46 AM
  3. [SOLVED] Error when trying to use code that works in Excel 2007 to 2010
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-23-2012, 10:38 AM
  4. Excel 2007 macro works differently on different systems.
    By marty_r in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2011, 05:11 PM
  5. Macro works correctly on Excel 2010, but not on 2007...why?
    By matgray87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2011, 06:04 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