+ Reply to Thread
Results 1 to 6 of 6

Worksheet Change Trigger - Update Another Cell

  1. #1
    Registered User
    Join Date
    01-22-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    55

    Worksheet Change Trigger - Update Another Cell

    Hi all,

    Cant quite get the knack of this one. Not to familiar with using the worksheet macro terms yet so hopefully someone change help.

    I have data in a table under two headings: (i) Status and (ii) Cost.

    I would like a macro to review the status column and, if ever the status of the activecell is set as the term "INACTIVE" then the offset cell in the cost column is updated to 0.

    For example:

    A B
    1 Status Cost
    2 ACTIVE 500.00
    3 INACTIVE 0.00

    I imagine it would go something like this but I cannot get it to work!


    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Not Intersect("Table1[Status]") Is "INACTIVE" Then
    Offset(0,1) = 0

    End If

    End Sub


    Any help would be much appreciated!

    Regards,

    Coeus.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Worksheet Change Trigger - Update Another Cell

    untested but perhaps
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    01-22-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Worksheet Change Trigger - Update Another Cell

    Amazingly fast response!

    One day I hope to have the same ability

    It worked like a charm thanks very much.

    Pushing it now but would you mind explaining the macro lines? Give a man a fish, teach a man to fish!

    Many thanks,

    Coeus.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Worksheet Change Trigger - Update Another Cell

    ok ;-)
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-22-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Worksheet Change Trigger - Update Another Cell

    Hi JosephP.

    Many thanks for the details freshly copied and pasted in to anaylse.

    I have one last favour to ask to make the macro perfect?

    When I insert a new row, as the status cell will naturally be blank an error notices shows. I have tried some error handling such as 'If Error Resume Next' but it changes everything in the sheet to 0!

    Not sure what the best approach is to handle errors within private sub macros?

    I didn't expect this to happen as in the table the cell has not been 'changed' but just 'created'?


    Bit confused but still a newbie so any help again would be very much appreciated!


    Regards,

    Coeus

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Worksheet Change Trigger - Update Another Cell

    I'm sorry-I was being lazy before because I was on an ipad-perhaps
    Please Login or Register  to view this content.

+ 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