The code below will paste the formulas in A1:A3 as value in A1:A3 when all the cells in A4:A400 are the same as the value in A3. Workbook is automatically saved, so you might want to test this code on a copy of your workbook first.
Here is the code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Application.WorksheetFunction.CountIf(Range("A4:A400"), Range("A3").Value) = 397 Then