+ Reply to Thread
Results 1 to 4 of 4

If activesheet.name not working

  1. #1
    Registered User
    Join Date
    05-30-2013
    Location
    montreal
    MS-Off Ver
    Excel 2010
    Posts
    2

    If activesheet.name not working

    Hi,

    So I have 3 macros in a workbook, each of which has the condition set as If ActiveSheet.CodeName = "XXX" Then ...

    The problem is that for one of them the macro still runs in every worksheet. I have tried both activesheet.name and codename with no luck.

    If I change between the 2, it will work only once and the the macro will run in every worksheet afterwards.

    Below is the macro:

    Please Login or Register  to view this content.
    Any help will be appreciated.

  2. #2
    Forum Contributor
    Join Date
    01-02-2007
    Location
    Australia NSW
    MS-Off Ver
    2013
    Posts
    494

    Re: If activesheet.name not working

    Try adding a selection of the sheet right after the If statement.

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: If activesheet.name not working

    Is the case correct on the sheet's name?

    P.S. the first part of your sub didn't make it to the post.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Registered User
    Join Date
    05-30-2013
    Location
    montreal
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: If activesheet.name not working

    thanks for the fast reply:

    full script below, the name is all in small letters, no caps.

    Please Login or Register  to view this content.
    what do you mean by "Try adding a selection of the sheet right after the If statement. "?
    doe you mean to do:

    Please Login or Register  to view this content.
    I used to have that and removed it. but it still seems to run no matter what
    Last edited by alexaa; 05-31-2013 at 12:14 AM.

+ 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