+ Reply to Thread
Results 1 to 4 of 4

Worksheet testing?

  1. #1
    Forum Contributor
    Join Date
    03-07-2013
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    274

    Worksheet testing?

    Hello,

    I need to execute a piece of code only when the user modifies certain columns. However
    I noticed that the code runs also when those same columns across all my other worksheets get modified!!!

    So I tried putting an "if" statement before the code in question so to identify if the columns that the user modifies are actually in the correct worksheet.

    Here is the code:

    Please Login or Register  to view this content.
    However at the line where I test if the current worksheet is "Main" I get an error

    Does anyone know how we can test for the current worksheet name with an "if" statement?

    Thank you for your help

    RN

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Worksheet testing?

    Try:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: Worksheet testing?

    if you only want to run the code one 1 sheet, would it not make more sense to then put the code in the worksheet module using the worksheet_activate event instead of Thisworkbook module as it is now..

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Worksheet testing?

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ 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. [SOLVED] 123 testing, testing to see if i get notifications or not.
    By JimmyWilliams in forum Excel General
    Replies: 6
    Last Post: 01-14-2018, 01:12 PM
  2. [SOLVED] testing testing
    By FDibbins in forum The Water Cooler
    Replies: 0
    Last Post: 11-19-2015, 10:04 PM
  3. [SOLVED] Testing an unopened (or opened) worksheet for VBA Project protected
    By Ken Loomis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-18-2005, 08:18 AM
  4. [SOLVED] Testing 123
    By SupportX in forum Excel General
    Replies: 0
    Last Post: 07-04-2005, 06: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