+ Reply to Thread
Results 1 to 3 of 3

Specifying Active worksheet in VBA

  1. #1
    Forum Contributor
    Join Date
    07-25-2008
    Location
    texas
    Posts
    178

    Specifying Active worksheet in VBA

    I used the "record macro" and went through my data manipulation steps.
    But its not transferable to other worksheets because it imbedding the name of the worksheet in the some functions (sort, pivottable,...).
    How can I change the name of the worksheet to "activeworksheet"?
    Last edited by jartzh; 02-16-2009 at 10:55 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Specifying Active worksheet in VBA

    If you want to fire against the activesheet you can dispose of the sheet qualifier - the VBA will fire against the active sheet at time of command being executed unless specifically coded otherwise, so instead of say:

    Please Login or Register  to view this content.
    you could use the below to fire against the activesheet

    Please Login or Register  to view this content.
    You can though use ActiveSheet rather than Sheets("Sheet1") if you prefer, ie

    Please Login or Register  to view this content.
    It would be better though to post the code in question...

  3. #3
    Forum Contributor
    Join Date
    07-25-2008
    Location
    texas
    Posts
    178

    Re: Specifying Active worksheet in VBA

    DonteOke,
    Thanks,
    Thats perfect. I didn't consider that as an option.
    I guess its always best to look at the basics first.

+ 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