+ Reply to Thread
Results 1 to 8 of 8

Help 'freezing' value of formulas when date becomes 'today'.

  1. #1
    Forum Contributor Big.Moe's Avatar
    Join Date
    03-15-2012
    Location
    Corea, Maine, USA
    MS-Off Ver
    Excel 2010
    Posts
    262

    Help 'freezing' value of formulas when date becomes 'today'.

    Hello,

    I already have this handy code that 'freezes' the current value of a formula when there is activity in the cell adjacent.
    Please Login or Register  to view this content.
    Now I would like to do a similar process for the "Item Description" column. This time I would like the formula values to 'freeze' when the associated date for that day becomes the current date.

    Freeze Column.jpg

    Regretfully, the column letter always changes, and the date cell always changes. However, they always have the same juxtaposition (see attached file of typical month sheet below). Sorry, could not upload whole workbook due to size constraints.

    My VBA skills are next to nothing, but this is the general direction of what I think the code should look like:
    Please Login or Register  to view this content.
    Thanks for reviewing my post and hopefully I've clearly described the problem at hand. Not always the easiest task to master.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Help 'freezing' value of formulas when date becomes 'today'.

    You could use this code to put in worksheet change:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  3. #3
    Forum Contributor Big.Moe's Avatar
    Join Date
    03-15-2012
    Location
    Corea, Maine, USA
    MS-Off Ver
    Excel 2010
    Posts
    262

    Re: Help 'freezing' value of formulas when date becomes 'today'.

    Hi Antonio,
    Forgive me, but I'm having trouble getting your code to work. This is how I inserted it into my existing code:
    Please Login or Register  to view this content.
    Is this correct? My apologies, but I was not exagerating when I mentioned my VBA skills were next to zero.

    Couple Questions:
    "If Target.Parent.Cells(8, Target.Column) = "RETAIL" Then"
    Does the "8" denote a cell reference? If that is the case, I think it might need to be a "40" because that is where the "Retail" call-outs begin on the sheet.

    "If Format(Target.Parent.Cells(2, Target.Column + 9)"
    What does the "2" represent in this part of the code?

    Does the code automatically change the formulas to values when the current date matches the sheet date?

    Thanks.

  4. #4
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Help 'freezing' value of formulas when date becomes 'today'.

    Excuse me but I realized a different ask.

    Try with this code:
    Please Login or Register  to view this content.
    Target.Parent refers to the sheet, for example Target.Parent.Cells(2, Target.Column + 9) refers to the date that is 9 columns right the column with Category at row 2.

    Regards,
    Antonio

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Help 'freezing' value of formulas when date becomes 'today'.

    Hi Big Moe,

    I'm interested in this thread and I'll try to help tomorrow
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Help 'freezing' value of formulas when date becomes 'today'.

    Hi Big Moe,

    It took quite a while before I realized that you had the date in a merged cell which made the offset just be 9!

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor Big.Moe's Avatar
    Join Date
    03-15-2012
    Location
    Corea, Maine, USA
    MS-Off Ver
    Excel 2010
    Posts
    262

    Re: Help 'freezing' value of formulas when date becomes 'today'.

    Thank you to both of you for your suggestions.

    For some reason, xladept's code is the one I got to work best, but I certainly appreciate both your efforts, and a little rep will go out to both of you.

    That "Application.EnableEvents = True/False" thing is pretty cool stuff. I thought the code would 'freeze' the values as soon as I open the file, but it waits until some activity happens which is even better. I'm going to read-up on "Application.EnableEvents = True/False" to better understand it.

    Thanks again for the help. What would we do without you forum gurus/experts?.....Probably toil away in our pedestrian Excel ineptitude.

    Oh, and my apologies for the sneaky merged cell.

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Help 'freezing' value of formulas when date becomes 'today'.

    Hi Big Moe,

    The code differs mainly in the fact that I used the selection change event (forgot to mention it).

    I should have read Antonio's code as he noticed the merged cell and was offsetting by just 9!

    You're welcome and thanks for the rep!

+ 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. Replies: 10
    Last Post: 09-06-2023, 08:19 PM
  2. [SOLVED] Sumif from date (Today or greater than today) to last date
    By thilag in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-23-2015, 03:53 AM
  3. Replies: 6
    Last Post: 08-08-2011, 08:32 AM
  4. Freezing and unfreezing formulas
    By john dalton in forum Excel General
    Replies: 0
    Last Post: 07-29-2011, 09:04 AM
  5. Freezing Formulas
    By vinid in forum Excel General
    Replies: 2
    Last Post: 04-13-2011, 11:11 PM
  6. Freezing Cell Formulas
    By fourgreatpoints in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-28-2008, 03:16 PM
  7. [SOLVED] freezing formulas
    By junoon in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-02-2006, 08:35 AM

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