Hi Jaan,
And This :
'----------------------------------------
Sub test()
Dim LastRow As Long, Rg As Range, X As Variant
On Error Resume Next
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
With .Range("N8:N" & LastRow)
Set Rg = .SpecialCells(xlCellTypeBlanks)
With Rg
.NumberFormat = "d-mmm"
.Formula = "=IF(" & Rg(1).Offset(-1).Address(0, 0) & "0,TODAY(),"""")"
End With
X = .Value
.Value = X
End With
End With
End Sub
'----------------------------------------
"Jaan" a écrit dans le message de groupe de discussion :
...
Hi All
I need help in resolving my error code. I would like to find the blank cells
in my range and then insert formula. Macro works correctly only first time.
If I run macro next time, it advice me next error:
Run-time error '1004': no cells were found.
My code you can see below
Dim Lrow As Long
With ActiveSheet
Lrow = Range("b8:B" & Rows.Count).End(xlDown).Row
Set myrange = Range("N8:N" & Lrow)
myrange.Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=IF(RC[-1]0,TODAY(),"""")"
myrange.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.NumberFormat = "d-mmm"
End With
If """" means "blank", then what is wrong in my code
Best Regards