Hi all,
I had a perfectly working macro for 1 column which when the work sheet is saved, the macro converts any formulas on a column that has today()+3 in, into a text, so when it saves, the date remains static.
I now need this macro to do the same job within 2 columns, however, it fails to pick up on the second column. This is my macro so far:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim cell As Range, cell2 As Range, DateRng As Range, DateRng2 As Range
Set DateRng = Sheets("January").Range("L5:L36665")
Set DateRng2 = Sheets("January").Range("B5:B36665")
For Each cell In DateRng
If IsDate(cell.Value) Then
cell.Copy
cell.PasteSpecial Paste:=xlPasteValues
End If
Next cell
For Each cell2 In DateRng2
If IsDate(cell2.Value) Then
cell2.Copy
cell2.PasteSpecial Paste:=xlPasteValues
End If
Next cell2
End Sub
Any help would be greatly appreciated it.
The original macro that works perfectly on 1 column is:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim cell As Range, DateRng As Range
Set DateRng = Sheets("January").Range("L5:L36665")
For Each cell In DateRng
If IsDate(cell.Value) Then
cell.Copy
cell.PasteSpecial Paste:=xlPasteValues
End If
Next cell
End Sub
Bookmarks