+ Reply to Thread
Results 1 to 4 of 4

Problems Using My Custom Function

  1. #1
    Forum Contributor
    Join Date
    10-25-2010
    Location
    Phoenix, Arizona, USA
    MS-Off Ver
    O365
    Posts
    201

    Angry Problems Using My Custom Function

    I have a numerous worksheets that contain data which is graphed several different ways.

    After my users enter the data, when they Deactivate the worksheet, I have a the following code for each of the worksheets.

    Please Login or Register  to view this content.
    This calls my custom function

    Please Login or Register  to view this content.
    First Question: Instead of using the specific worksheet name, how do I obtain the name of the sheet that was just deactivated, using Activesheet gives the name of the worksheet that was newly selected.

    Second Question: The "For Each" statement does not work...what do I have wrong?

    Lastly: When in VBA, on the properties dialog, I see (name) as the first entry, and then Name further down in the dialog. What's the different between the two? Should/can I use the (name) value, so that in case the user changes the tab name, the code will still work?


    Thank you.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Problems Using My Custom Function

    1. Use Me.Name

    2. Use

    Please Login or Register  to view this content.
    3. The first one is the Codename. Yes, you should change it to a meaningful name and use that.

  3. #3
    Forum Contributor
    Join Date
    10-25-2010
    Location
    Phoenix, Arizona, USA
    MS-Off Ver
    O365
    Posts
    201

    Re: Problems Using My Custom Function

    The Me.Name works great, gives the name of the worksheet that is being deactivated. Tested by putting "Msgbox Me.Name" in code.

    I ended up having to put a few more lines into the code...I also changed it from a function to a sub routine.

    Please Login or Register  to view this content.
    Any way of just referring to the deactivated sheet rather than selecting it?

  4. #4
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Problems Using My Custom Function

    Just use the worksheets(name) object.

+ 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