+ Reply to Thread
Results 1 to 9 of 9

Screen Updating Not Completely Disabled in Excel Macro

  1. #1
    Registered User
    Join Date
    01-07-2012
    Location
    Pleasanton, CA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Screen Updating Not Completely Disabled in Excel Macro

    Hi - I have an Excel macro that pulls data from Access queries, populating several different worksheets in the Excel file. I've disabled screen updating in the VBA code and that works fine...none of the operations performed in the worksheets are shown on screen. However, when I activate different worksheets in the code, the screen does show all the switching between worksheets, which is annoying and I don't want the users to see it. I thought turning off screen updating would take care of that, but I guess not. Does anyone know how to just stay on the worksheet where the user clicks the button to start the macro?

    Thanks,

    Jeff
    Last edited by jstroope; 01-10-2012 at 11:03 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Screen Updating Not Completely Disabled in Excel Macro

    You shouldn't ned to select or activate sheets
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    01-07-2012
    Location
    Pleasanton, CA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Screen Updating Not Completely Disabled in Excel Macro

    Thanks Roy,

    The problem is, if I do something like
    Please Login or Register  to view this content.
    I get an error if I don't first select or activate the worksheet.

    Thanks,

    Jeff
    Last edited by royUK; 01-08-2012 at 12:54 PM.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Screen Updating Not Completely Disabled in Excel Macro

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    Added this time

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Screen Updating Not Completely Disabled in Excel Macro

    What error? Post the full code or attach a workbook example

  6. #6
    Registered User
    Join Date
    01-07-2012
    Location
    Pleasanton, CA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Screen Updating Not Completely Disabled in Excel Macro

    Thanks Roy,

    The error message I get is, "1004 Application-defined or object-defined error". This is the code that throws the error:

    Please Login or Register  to view this content.
    I commented out the line where I activate the worksheet so it would error out. The number of rows varies depending on the parameters selected. Is there any other way to clear cells, add borders, etc without selecting or activating the worksheet?

    Thanks,

    Jeff

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Screen Updating Not Completely Disabled in Excel Macro

    You don't appear to declare any variables.

    This is wrong
    Please Login or Register  to view this content.
    It should be
    Please Login or Register  to view this content.
    Notice .Cells, not just Cells. You've used a With...End With Statement.

  8. #8
    Registered User
    Join Date
    01-07-2012
    Location
    Pleasanton, CA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Screen Updating Not Completely Disabled in Excel Macro

    Thanks Roy - I'll give it a try. The variables are declared as Public in a separate module.

  9. #9
    Registered User
    Join Date
    01-07-2012
    Location
    Pleasanton, CA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Screen Updating Not Completely Disabled in Excel Macro

    Thanks Roy - it worked and it makes perfect sense.

+ 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