+ Reply to Thread
Results 1 to 9 of 9

Focusing on cells without "selecting" them

  1. #1
    Registered User
    Join Date
    09-05-2013
    Location
    West Plains, Missouri
    MS-Off Ver
    Access 2003, Excel 2007
    Posts
    18

    Focusing on cells without "selecting" them

    Hi all,

    I am still fairly new to VBA and have in issue I can not solve. Is there a way to set the focus on a range of cells and have a fuction, like sort, happen without actually selecting that range? I want my macro to run in the background without disturbing what I am doing on my other open spreadsheets. Currently if the wookbook is not open, I get an error, also I want the sort to happen without the screen flashing at me. Here is my code:

    Please Login or Register  to view this content.
    Hope I did that right!

    All help is appreciated!
    ToddHarmon

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Focusing on cells without "selecting" them

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    09-05-2013
    Location
    West Plains, Missouri
    MS-Off Ver
    Access 2003, Excel 2007
    Posts
    18

    Re: Focusing on cells without "selecting" them

    That helped out some, taught me a cleaner way to code. I am still getting a "run time error-'9' Script out of range" message when another spreadsheet is open and in use. Any way to fix this problem?

    Rep for the cleaner code!

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Focusing on cells without "selecting" them

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Focusing on cells without "selecting" them

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-05-2013
    Location
    West Plains, Missouri
    MS-Off Ver
    Access 2003, Excel 2007
    Posts
    18

    Re: Focusing on cells without "selecting" them

    Thank you, I will see if that works for me. I may have been using that command improperly.

  7. #7
    Registered User
    Join Date
    09-05-2013
    Location
    West Plains, Missouri
    MS-Off Ver
    Access 2003, Excel 2007
    Posts
    18

    Re: Focusing on cells without "selecting" them

    Still doesn't seem to work for me. I am showing all of my code for this project to see if it is something else that is causing the problem. The Update_Link module works like it should, and so does the sort module as long as this spreadsheet is the open one. As soon as I open any other spreadsheet it now gives a stop 400 error.

    Please Login or Register  to view this content.
    I'm completely confused as to why it won't work. All of the code is in the "ThisWorkbook" section in VBA. Do the modules need to be seperated maybe?

  8. #8
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Focusing on cells without "selecting" them

    Usually I put all macros in Modules, not in ThisWorkbook area.
    I put only some event macros in ThisWorkbook area.

  9. #9
    Registered User
    Join Date
    09-05-2013
    Location
    West Plains, Missouri
    MS-Off Ver
    Access 2003, Excel 2007
    Posts
    18

    Re: Focusing on cells without "selecting" them

    Going to mark this one as solved. Since this program is primarily used as a stand alone, I have added a workaround by disabling the macro by user input. Thanks for the help, it is appreciated!

+ 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. Replies: 5
    Last Post: 01-23-2014, 11:02 AM
  2. [SOLVED] selecting cells accordnig to date, "countif"
    By rodgersmg in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-12-2013, 01:55 AM
  3. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  4. Replies: 3
    Last Post: 01-25-2011, 09:31 PM
  5. pasting problem after selecting "go to" cells
    By Santana20 in forum Excel General
    Replies: 2
    Last Post: 03-09-2010, 03:08 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