+ Reply to Thread
Results 1 to 3 of 3

Sheets("sheet_name").Select

  1. #1
    Registered User
    Join Date
    09-10-2012
    Location
    Sweden
    MS-Off Ver
    Excel 2003
    Posts
    7

    Sheets("sheet_name").Select

    Hi all,

    Is it possible to use the Sheets.Select function but instead of specifying the sheet name, specify the sheet which was active when I started the macro?

    What I want to do is to do a Macro where a update all Pivots in workbook, from different sheets. After the macro, then I want to return to the sheet from where I run the macro.

    Thanks!

    Martin

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Sheets("sheet_name").Select

    Hi, Martin,

    IŽd recommend not to switch Cells or Worksheets in the course of a macro.

    Maybe proceed like this:
    Please Login or Register  to view this content.
    Alternative:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,373

    Re: Sheets("sheet_name").Select

    You'd have to store a reference to the worksheet.

    Something like:

    Please Login or Register  to view this content.

    Or

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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