+ Reply to Thread
Results 1 to 19 of 19

fill/copy and then keep value from changing

  1. #1
    Registered User
    Join Date
    03-23-2015
    Location
    us
    MS-Off Ver
    365
    Posts
    93

    fill/copy and then keep value from changing

    See attached sample::

    Col A = date
    D2 changes value each entry date

    Col B = D2 [value] on the date entered
    then retains this value when date & D2 changes

    Example: see attached

    On 3/3, D2 = 45, then want B3 to = 45

    On 4/18, D2 = 25, then want B4 to = 25, and B3 = 45, [B3 retain original value]

    On 6/28, D2 = 100, then want B5 = 100, B4 to = 25, and B3 = 45, [B3 & B4 retain original values]

    On 7/28, D2 = 200, then want B6 = 200, B5 = 100, B4 to = 25, and B3 = 45, [B3,B4,B5 retain original values]

    On next entry date, D2 = XX, then want B7 = XX, B6 = 200, B5 = 100, B4 to = 25, and B3 = 45, [B3,B4,B5,B6 retain original values]
    Attached Files Attached Files
    Last edited by skipro; 07-30-2021 at 06:31 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,482

    Re: fill/copy and then keep value from changing source

    You will need VBA for this. Shall I move your thread for you?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-23-2015
    Location
    us
    MS-Off Ver
    365
    Posts
    93

    Re: fill/copy and then keep value from changing source

    Yes. Thank you.

  4. #4
    Registered User
    Join Date
    03-23-2015
    Location
    us
    MS-Off Ver
    365
    Posts
    93

    Re: fill/copy and then keep value from changing source

    Quote Originally Posted by AliGW View Post
    You will need VBA for this. Shall I move your thread for you?
    If this gets no response in a few days, I would like the moderator to resubmit this post to the original forum as this can be done with a formula.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,482

    Re: fill/copy and then keep value from changing

    How do you know?

    Thread moved back to functions and formulas section.

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,578

    Re: fill/copy and then keep value from changing

    As already told this is not possible with formula. here is the worksheet event code.

    Please Login or Register  to view this content.
    Worksheetevent

    How to use the code
    Right click on Sheet tab --> view code
    Visual Basic (VB) window opens.
    Paste the code
    Close the VB window.
    Save the file
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 07-31-2021 at 08:16 AM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,482

    Re: fill/copy and then keep value from changing

    As already told this is not possible with formula. here is the worksheet event code.
    He didn't believe me ...

  8. #8
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,578

    Re: fill/copy and then keep value from changing

    Possibly he may be having more faith in formula.

  9. #9
    Registered User
    Join Date
    03-23-2015
    Location
    us
    MS-Off Ver
    365
    Posts
    93

    Re: fill/copy and then keep value from changing

    kvsrinivasamurthy,
    Thank you.

    My Excel formula and code knowledge is very limited and primitive. My queries are not to challenge, only to learn.

    1) Why do you have "Application.EnableEvents = False"? Please give specific need.
    2) Your code responds for any change as specified and is not TODAY() specific. Can it be made to be run only if the current date is entered.

    AliGW & kvsrinivasamurthy:
    Why is this request/task not viable with a formula?
    Last edited by skipro; 08-01-2021 at 11:45 PM.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,482

    Re: fill/copy and then keep value from changing

    Formulae always update. In a cell, you can have either a dynamic formula or a static value, but not both. Excel has no way of turning a formula cell into a static value based on the date without VBA.

    There is a way to create a time stamp in Excel, but it would not work for what you want, which changes each day in a sequential way.

    It’s VBA or nothing, I am afraid.

  11. #11
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,578

    Re: fill/copy and then keep value from changing

    Try this code
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    03-23-2015
    Location
    us
    MS-Off Ver
    365
    Posts
    93

    Re: fill/copy and then keep value from changing

    kvsrinivasamurthy,

    Does this need "Application.EnableEvents = False" and "Application.EnableEvents = true" ?
    If so, why?

  13. #13
    Registered User
    Join Date
    03-23-2015
    Location
    us
    MS-Off Ver
    365
    Posts
    93

    Re: fill/copy and then keep value from changing

    AliGW,
    I just reread my post requesting this be moved back to "Formula" forum.
    "---- resubmit this post to the original forum as this can be done with a formula."
    That was not what I intended to write/ask. It should have read, "--- to see if this can be done with a formula."

  14. #14
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,578

    Re: fill/copy and then keep value from changing

    Post#12
    yes, it is necessary. It prevents triggering the event when changes are done in cells due to the event program.

  15. #15
    Registered User
    Join Date
    03-23-2015
    Location
    us
    MS-Off Ver
    365
    Posts
    93

    Re: fill/copy and then keep value from changing

    KV
    Thank you.
    My knowledge is rudimentary. Please explain "changes are done in cells due to the event program". Can you give an example.

  16. #16
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,578

    Re: fill/copy and then keep value from changing

    When program is running if the value of a cell is changed by the program that should not initiate the program once again.
    This line, if target is A4 chnanges the value of B4 . This event should not run the program once again
    Target.Offset(0, 1) = [D2]

  17. #17
    Registered User
    Join Date
    03-23-2015
    Location
    us
    MS-Off Ver
    365
    Posts
    93

    Re: fill/copy and then keep value from changing

    Is there anyone in this forum who believes my request can be done with a formula? Does everyone believe it is impossible?

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,482

    Re: fill/copy and then keep value from changing

    It cannot be done with a formula.

  19. #19
    Registered User
    Join Date
    03-23-2015
    Location
    us
    MS-Off Ver
    365
    Posts
    93

    Re: fill/copy and then keep value from changing

    AliGW & kvsrinivasamurthy, and other non-believers,
    "O Ye of little faith" - Mathews 6:30

    I have gotten only 2 responses to this challenge, both declaring it is impossible to do this with a formula. Therefore it appears the other experts who populate this forum agree and did not try to create "the impossible", or do not agree but are stumped by this challenge.
    I have only very basic knowledge of scripting or writing formulas. My approach is just logic driven.
    I am also a heretic, skeptical and stubborn.
    I played with devising a formula. Spent way too much time, but for me it is also a learning process. Inherently curious.

    That said, please check out my sample.
    The left is a script [provided by kvsrinivasamurthy], the right formula driven.
    I think both do the task as originally sought.
    Attached Files Attached Files

+ 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. changing the source of a link?
    By mes2370 in forum Excel General
    Replies: 2
    Last Post: 12-31-2020, 06:59 PM
  2. Replies: 4
    Last Post: 08-08-2019, 09:02 PM
  3. [SOLVED] Formula to fill account with 2 source
    By dolphino in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-23-2019, 06:27 AM
  4. Replies: 2
    Last Post: 09-28-2016, 02:09 PM
  5. [SOLVED] Changing fill color of shapes based on changing cell value
    By Stefan1983 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2012, 10:33 AM
  6. Replies: 0
    Last Post: 06-11-2009, 09:42 AM
  7. Fill Formula Down Based on Source
    By Fonzy in forum Excel General
    Replies: 2
    Last Post: 04-07-2008, 03:19 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