+ Reply to Thread
Results 1 to 3 of 3

How to set active sheet

  1. #1
    Forum Contributor
    Join Date
    09-19-2016
    Location
    Alaska
    MS-Off Ver
    MS 2010, 2013, 2016
    Posts
    272

    How to set active sheet

    Hello guys - its me again.

    I have managed to make additional changes to the macro below and it runs well. Only issue here is that it only looks at worksheets named book1. The macro will be used on worksheets that are named differently so i tried to change it look the active sheet. I tried using examples found online but kept running into issues.

    Here is what I entered :

    Please Login or Register  to view this content.
    to replace
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by AccountingJ; 06-14-2018 at 04:18 PM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to set active sheet

    Active sheet means any sheet where the cursor happens to be at any point. The cursor needs to be on the sheet you want to be active before you run the code.

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: How to set active sheet

    You didn't say what issues you are running into, and the file you attached is .xlsx and so does not have any code.

    Just based on the code you posted, if you want to replace this
    Please Login or Register  to view this content.
    Just use this instead of creating a new object
    Please Login or Register  to view this content.
    Also I recommend using meaningful names for variables. Using one-letter names for all variables makes the code hard to read and understand.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. Macro to go back to the last active sheet and hide the active sheet
    By yatahaze in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2014, 08:18 AM
  2. Replies: 1
    Last Post: 07-07-2014, 09:19 AM
  3. [SOLVED] save active sheet in new workbook, naming it as cell value of active sheet
    By arkharova.s in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-18-2014, 06:16 AM
  4. Replies: 1
    Last Post: 01-04-2014, 06:37 PM
  5. Macro to Print active sheet as PDF to Active workbook and customize name
    By Scott Taylor in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-17-2012, 08:52 PM
  6. how can worksheet_activate event of active sheet work of active workbook
    By tahir mahmood in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2011, 08:19 AM
  7. [SOLVED] Copy from active sheet and paste into new sheet using info from cell in active
    By Ingve in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2006, 06:00 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