ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   WB before save event problem (https://www.excelbanter.com/excel-programming/337534-wb-before-save-event-problem.html)

GregR

WB before save event problem
 
I have a PO log workbook which has an "if" formula in Column(AB) which
enters todays date in the cell, if anything is filled in Column(R) same
row. This performms as expected. I also have a before save event which
converts the formula to a value, code below

columns("AB").value = columns("AB").value

The problem is, it wipes all my "if" formulas to values. What do I need
to change to affect only those rows where there is something entered in
Column(R) and preserve my "if" formulae. TIA

Greg


Ron de Bruin

WB before save event problem
 
Hi GregR

You can't use a formula for this

You can do it with the change event of the worksheet
This example will place the date/time in the AB column if you change
a cell in the range R1:R200.

Place the code in the Sheet module

Right click on a sheet tab and choose view code
Paste the code there
Alt-Q to go back to Excel

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("R1:R200"), Target) Is Nothing Then
Target.Offset(0, 10).Value = Format(Now, "mm-dd-yy hh:mm:ss")
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"GregR" wrote in message ups.com...
I have a PO log workbook which has an "if" formula in Column(AB) which
enters todays date in the cell, if anything is filled in Column(R) same
row. This performms as expected. I also have a before save event which
converts the formula to a value, code below

columns("AB").value = columns("AB").value

The problem is, it wipes all my "if" formulas to values. What do I need
to change to affect only those rows where there is something entered in
Column(R) and preserve my "if" formulae. TIA

Greg




GregR

WB before save event problem
 
Ron, thanks for the very speedy reply.

Greg



All times are GMT +1. The time now is 12:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com