+ Reply to Thread
Results 1 to 7 of 7

VB works only when value is typed into cell, not when formula updates cell value

  1. #1
    Registered User
    Join Date
    02-17-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    17

    VB works only when value is typed into cell, not when formula updates cell value

    Greetings,

    I have this VB code that is running on my worksheet. What I'm attempting to do here is insert 'Date' in the adjacent cell (Column J) when the word "Delivered" is updated into the target cell (Column I). This is working in part. When I focus on a cell in column I and type in the word "Delivered", the adjacent cell in column J gets the Date stamp. But my issue is that I am not typing in the word 'Delivered'. Instead, a formula is evaluating other cells in the worksheet and when all of those cells are marked as 'Complete' then the word 'Delivered' is filled into the cell in column I. My problem here is that when the formula inserts 'Delivered', then the offset cell (Column J) does not get the Date.

    How can I get around this issue? Or is there another way that I should be populating this date? I discovered that I cannot simply use a formula in the worksheet because the date keeps dynamically changing, so that's why I went the VB route.

    Here's my VB Code:

    Please Login or Register  to view this content.
    The other issue is that if the word 'Delivered' is removed from column I, I want the date in the adjacent cell to be cleared. I would also like to limit this VB code to 'Delivered' in column I only if at all possible.

    Sorry for the questions but I'm new to VB. Thanks so much for the help!
    Regards,

    Drew
    Last edited by dwiseman; 04-25-2010 at 10:19 PM.

  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: VB works only when value is typed into cell, not when formula updates cell value

    I assume that the value in I2 would change to "Delivered" when other values in row 2 changed, correct? Each row is a separate set of data?

    We can adjust your macro to check the current row anytime a value changes and change column "I" for that row only, then add/delete the date stamp as needed.

    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!)

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

    Re: VB works only when value is typed into cell, not when formula updates cell value

    Perhaps something like this would work if all of the cell's precedents are on the same sheet.
    Please Login or Register  to view this content.
    Last edited by teylyn; 04-26-2010 at 12:16 AM.
    _
    ...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
    02-17-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: VB works only when value is typed into cell, not when formula updates cell value

    Guys,

    You are geniuses!
    mikerickson - I never got to testing your solution, as the one proposed by JBeaucaire was exactly what I needed. Thanks to all of you for the help.

    This forum is invaluable and I do appreciate it!

    Best regards,
    Drew

  5. #5
    Registered User
    Join Date
    02-17-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: VB works only when value is typed into cell, not when formula updates cell value

    Guys,

    One small thing I did notice with this solution provided by JBeaucaire is that it applies to the entire column. I have mutliple headings and the data starts at Row 11 so I really only want this code to apply to rows 11 and below. My biggest concern is that I don't want values in rows 1-10 to be blanked out when the word Delivered is not present. I tried to plug in a range but had no luck getting that to work.

    Any idea on that?

    Thanks so much,
    Drew

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

    Re: VB works only when value is typed into cell, not when formula updates cell value

    Here you go:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-17-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: VB works only when value is typed into cell, not when formula updates cell value

    Beautiful! Thanks for the insight. Works like a champ!

    Drew

+ 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