+ Reply to Thread
Results 1 to 10 of 10

Screen Movement With Macros

  1. #1
    Registered User
    Join Date
    10-16-2008
    Location
    DFW
    Posts
    15

    Screen Movement With Macros

    I've made quite a few programs I use in excel and have wondered about this for awhile.

    When you run a macro that selects cells and objects off screen or on other sheets, the screen moves to those places. Is there anyway to lock the sheet so this doesn't happen and things look a bit more professional ?

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    The general answer is that you rarely need to select anything to operate with it, so don't.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    07-06-2008
    Location
    NC
    Posts
    149

    Not sure

    When I use a macro I do this:
    HTML Code: 
    at the beginning then do this at the end of the macro
    HTML Code: 
    Is this what you were looking to do??

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I agree with SHg, the main cause of socalled screen flickering is Selectin and it is generally unnecessary.
    Hope that helps.

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

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    10-16-2008
    Location
    DFW
    Posts
    15
    Okay, that makes since. Just how do you write code that doesn't select. You see, I learned what little I know by recording macros and looking at them, kind of a hack at this, but I get it done.

    Here is an example, how would you do this without actually selecting sheets and cells etc.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-16-2008
    Location
    DFW
    Posts
    15
    Quote Originally Posted by JK1234 View Post
    When I use a macro I do this:
    HTML Code: 
    at the beginning then do this at the end of the macro
    HTML Code: 
    Is this what you were looking to do??


    That does exactly what I was wanting.

    Thanks!

    But, is there something else I should be doing as far as my last posted code?

  7. #7
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi,

    Here's a slightly modified version of your code which shows how some of the sheet selection & can be removed & also how you can use With statements when multiple things are being done to a single object...

    Please Login or Register  to view this content.
    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I can't test this without an example but something like this
    Please Login or Register  to view this content.
    Last edited by royUK; 10-18-2008 at 04:33 AM.

  9. #9
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    on second thoughts this may be quicker for getting the new sheet name (replace my previous "for i = 10 to 2" with the below...

    Please Login or Register  to view this content.
    hth
    Rob

  10. #10
    Registered User
    Join Date
    10-16-2008
    Location
    DFW
    Posts
    15
    Now I need to sit down and see exactly what you've done.

    I really appreciate the help,
    Michael

+ 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. Screen Movements with Macros
    By ravichander in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-05-2008, 09:48 PM
  2. Advanced Filter + Several Macros
    By excel_owns_me in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-12-2007, 02:52 AM
  3. 'Enable Macros' message with no macros
    By nebb in forum Excel General
    Replies: 1
    Last Post: 06-07-2007, 07:04 AM
  4. But there are no macros!
    By Ms_Teacher in forum Excel General
    Replies: 3
    Last Post: 10-01-2006, 08:27 PM
  5. Get Rid of "Enable Macros" dialogue box - no macros!
    By jrgrott in forum Excel General
    Replies: 2
    Last Post: 09-14-2006, 03:22 PM

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