+ Reply to Thread
Results 1 to 15 of 15

Screen Updating

  1. #1
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Screen Updating

    Hi all,

    I have a problem that i just cannot wrap my brain around.

    My reset macro here, works terrific, and does not show any steps when running the macro.
    Please Login or Register  to view this content.
    But when i add two select lines to my macro, shown here, the screen updating begins and i cannot figure it out since i still have all of the screen updating code the same. This problem is killing me and i have been trying to figure it out for a few days now. Any help is greatly appretiated. Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Re: Screen Updating

    Why are you selecting those cells? What purpose does that serve?

  3. #3
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: Screen Updating

    I am selecting them because there is a macro on the other pages that will not work until that cell is selected. the macro is a conditional locking of cells, so i have to clear the contents in I8 and I9, the conditional cells, then select a non locked cell, then clear all of the cells that were locked. So I have to select C56 in order to clear the rest of the cells C37 to C56. Also on the second one it is the same locking macro. I am thinking i could use something like .Deselect, but i don't know the correct command for it. Thanks

  4. #4
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Re: Screen Updating

    I think your other macro is causing the screen to update. I ran a test on my computer and when selecting cells the update occurs at the very end of the macro with screen updating set to false. Make sure your other macros have the line

    Please Login or Register  to view this content.

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Screen Updating

    is the other macro a worksheet_selectionchange event?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  6. #6
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: Screen Updating

    Does every macro on every page get that line, if so when in the code, very first... Also does it get Application.ScreenUpdating = True at the end?

  7. #7
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: Screen Updating

    Okay, your solution worked for that fix, but i am still having another problem. On the pages entitled Claim Count - Credibility, and Loss Development factors i have this code to make sure the user know to only copy and paste values. Whenever i run my reset macro with the .Select i am getting these boxes that pop up and i have to click okay for them to go away and continue the macro. This was not hapening with no .Select before but it was happening with it in, i was hopping it would go away with your last fix, but it does not. Do i need Screen updating = True at the end of them or what. Thanks,

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: Screen Updating

    Quote Originally Posted by JosephP View Post
    is the other macro a worksheet_selectionchange event?
    JosephP, i am not sure what a worksheet_selectionchange even is.

  9. #9
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Re: Screen Updating

    Any message box will run whether or not screen updating is false. So if at some point you activate a macro with a message box the code will run the box when it gets to it. One way to get around the message boxes is have a public variable as a boolean. When you go to reset, make the boolean false...

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

  10. #10
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Screen Updating

    it is a routine that runs automatically in response to you selecting a different cell or cells on a sheet.
    you need
    Please Login or Register  to view this content.
    to stop the activate event code from running when you select the sheet. make sure you turn events back on again though. :-)

  11. #11
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: Screen Updating

    111StepsAhead,
    I am sorry, I am pretty new to VBA, I understand what you are trying to do, but where does this code go? Does it go as a new macro or somewhere in my existing reset macro or in the existing box macros? Thank you for all of your help.

  12. #12
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: Screen Updating

    Quote Originally Posted by JosephP View Post
    it is a routine that runs automatically in response to you selecting a different cell or cells on a sheet.
    you need
    Please Login or Register  to view this content.
    to stop the activate event code from running when you select the sheet. make sure you turn events back on again though. :-)
    JosephP, Like i told 111StepsAhead. I am a VBA newbie, where does your code go? Thank you

  13. #13
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Re: Screen Updating

    In your VBA project area you should see a list of modules on the left side. If you don't, go up to insert -> module. Now you will see a module. Select the one you created or any module. Near the top, not in any Sub or Function place the public variable.

    Please Login or Register  to view this content.
    Next you need to set the public or global variable you created. Sometimes people have a macro that automatically runs when the workbook opens. You can find that macro under the Microsoft Excel Objects, "ThisWorkbook". Near the top there is a dropdown. Select "Workbook". In the second dropdown to the right select Open. Now a new sub has been created. Put the second code there.

    Please Login or Register  to view this content.
    Finally, in every message box that you want to turn off put the final code.

    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Re: Screen Updating

    I should mention that the public variable in this example is only set when you open the workbook. If you try to run the code without assigning a value to it the code will throw an error at you.

  15. #15
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Screen Updating

    I reckon something like this
    Please Login or Register  to view this content.

+ 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