Reference:
http://groups.google.com/group/micro...0616e111e2f166

Dear Experts

Columns E has folloiwng formula

PHP Code: 
=IF(AND($A2>=$C$2,$A2<=$D$2),IF(COUNTIF($B$2:$B2,$B2)=1,$B2,""),""
This works fine, But I want to fill Coulmn E with VBA codes.
To do this, I wrote this formula but it show error
Please help
PHP Code: 
Sub Command1_Click()
    
Dim iRow As LongLastr As Long
    With Sheets
("sheet1")
        
Lastr = .Range("A" & .Rows.Count).End(xlUp).Row
        
For iRow 2 To Lastr
            
.Cells(iRow"E").Value "=IF(AND($A3>=$C$2,$A3<=$D$2),IF(COUNTIF($B$2:$B3,$B3)=1,$B3,""),"")"
        
Next iRow
    End With
End Sub 
column A has Dates as 01-07-2007,02-07-07
Column B has cash as 10,20,30,40
C1 has criteria1 date
D1 has criteria2 date
column E has unique values