+ Reply to Thread
Results 1 to 8 of 8

Attempting not to use Worksheet.Activate

  1. #1
    Registered User
    Join Date
    07-04-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Question Attempting not to use Worksheet.Activate

    Hello,

    I have read various posts on this forum regarding not using .Activate on worksheets if possible for various reasons. Therefore I have tried to clean up one particular piece of code to adhere to this. However, I am having trouble doing so.

    Here is the code in working format :

    Please Login or Register  to view this content.
    When I try to replace this :

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

    Please Login or Register  to view this content.
    I get the "Run-time error '1004' : Select method of Range class failed".

    Any help, very much appreciated.

    Thanks
    Matt

  2. #2
    Registered User
    Join Date
    02-25-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    46

    Re: Attempting not to use Worksheet.Activate

    I would suggest not using Select as well. It is almost never necessary.

  3. #3
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Attempting not to use Worksheet.Activate

    Please Login or Register  to view this content.
    Please click the * below if this helps

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Attempting not to use Worksheet.Activate

    Possibly:- you are selecting two adjacent cells and then you are looking for an empty cell below them and outside the range.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  5. #5
    Registered User
    Join Date
    07-04-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Re: Attempting not to use Worksheet.Activate

    Thanks for the advice so far, I've managed to get a little further along.

    I am now getting the same error for this last section of my code :

    Please Login or Register  to view this content.

  6. #6
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Attempting not to use Worksheet.Activate

    Why do you do all the selecting...?

    Please Login or Register  to view this content.
    Please click the * below if this helps

  7. #7
    Registered User
    Join Date
    07-04-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Re: Attempting not to use Worksheet.Activate

    Thanks for your help guys.

    Why do you do all the selecting...?
    I wish to return the cursor to the cell A1 position (i.e. CTRL & Home) on certain worksheets. Is there a way of doing this without either using .Select or .Activate, if not which is the most efficient option?

    Thanks
    Matt

  8. #8
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Attempting not to use Worksheet.Activate

    Activate is always the way to go.
    My code should do what you want.

+ 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. Attempting to AutoFit Row on another Worksheet
    By dhoff in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-07-2013, 05:52 AM
  2. Replies: 3
    Last Post: 10-10-2012, 05:10 PM
  3. Worksheet Change and Worksheet Activate Events Reprotecting Automatically
    By excelnewb02 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-21-2012, 08:44 PM
  4. Avoiding Errors When Attempting To Retrieve Data From A Non-existant Worksheet
    By BloodyShrapnel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-23-2006, 09:25 PM
  5. Activate Previous worksheet after adding a new worksheet
    By Chingangel@yahoo.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-18-2005, 08:05 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