Jyggalag

Active Member
Joined
Mar 8, 2021
Messages
422
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi all,

I am currently using this formula:

1643791912044.png


With its neighbor formula in column C going like this:

1643791832395.png


My question is whether it would be possible to somehow freeze my data in cell B3, C3 etc. going forward? So once the formula detects that a data entry has been in the cell 2 rows below it, it will update the date and then freeze this date.

Is this possible? It would assist me a lot. Thank you! :)

Kind regards,
Jyggalag
 
The VBA isn't that complicated if all you are doing is inserting the date in row 3 when you amend the cell in row 5, as long as you are inserting the data in row 5 manually.
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Try the code below and see if it does what you want.
The code must go in the worksheet module (Right click the sheet tab, click View code and paste the code in the window that appears).

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Row = 5 And Target.Cells.CountLarge = 1 Then
        Application.EnableEvents = False
        If Target.Value <> "" Then
            Target.Offset(-2) = Date
            Columns(Target.Column).AutoFit
        End If
        Application.EnableEvents = True
    End If
End Sub

As stated this code is for if you changing the data in row 5 manually, if row 5 is changed via formula then it is a whole different ball game.
 
Upvote 0
Solution
Try the code below and see if it does what you want.
The code must go in the worksheet module (Right click the sheet tab, click View code and paste the code in the window that appears).

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Row = 5 And Target.Cells.CountLarge = 1 Then
        Application.EnableEvents = False
        If Target.Value <> "" Then
            Target.Offset(-2) = Date
            Columns(Target.Column).AutoFit
        End If
        Application.EnableEvents = True
    End If
End Sub

As stated this code is for if you changing the data in row 5 manually, if row 5 is changed via formula then it is a whole different ball game.

Thank you Mark!

I believe this solves it :) I will utilize this code soon
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,680
Members
449,116
Latest member
HypnoFant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top