+ Reply to Thread
Results 1 to 2 of 2

capture the name of the target passed into Worksheet_Change event

  1. #1
    Registered User
    Join Date
    01-21-2013
    Location
    Cold Spring, New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    capture the name of the target passed into Worksheet_Change event

    I'm using Excel VBA for the first time. Have used VBA with Access but a long time ago.

    I want to do some complex validation of cell values, namely format (must be numeric), range (must be 1 - 50) and whether other cells have data in them. I know I can do the format/range validation in one step using Data Validation, but I don't see how to do the =AND for checking the other cells in addition to the first step. Therefore, my idea is to use VBA for the validation.

    All of the cells that are unlocked for input have names. THe reason I think using the Name rather than the cell position is better in the VBA code is because the position of the cell might change as I add or delete things from the worksheet. EG, the name BR1_1 will always be in the worksheet, but although it refers to cell C18 right now, it could be C25 tomorrow.

    So, I want to capture the name of the Target, not it's position in the worksheet. Using Target.name in VBA gives me Calculator!$c$18. I can loop through the Names in the worksheet and find BR1_1. How do I get the name of Calculator!$c$18?

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: capture the name of the target passed into Worksheet_Change event

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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