satish gubbi
02-21-2012, 06:41 AM
Hi
I found the below code in VBA express forum which adds formula into the column, i have modified as per my requirement, however I am getting an error.
I need this code to place the formula if the cell value > 0 (if the cell has some value or it should be left blank)
Kindly help
Sub Fill()
Dim lLR As Long
lLR = Cells(Rows.Count, "B").End(xlUp).Row
With Range("D:D" & ILR)
If ILR > 0 Then
.Formula = "=IF(LEFT(RC[-2],3)=""FW:"",RIGHT(RC[-2],LEN(RC[-2])-4),IF(LEFT(RC[-2],3)=""RE:"",RIGHT(RC[-2],LEN(RC[-2])-4),RC[-2]))"
.Value = .Value
End If
End With
End Sub
I found the below code in VBA express forum which adds formula into the column, i have modified as per my requirement, however I am getting an error.
I need this code to place the formula if the cell value > 0 (if the cell has some value or it should be left blank)
Kindly help
Sub Fill()
Dim lLR As Long
lLR = Cells(Rows.Count, "B").End(xlUp).Row
With Range("D:D" & ILR)
If ILR > 0 Then
.Formula = "=IF(LEFT(RC[-2],3)=""FW:"",RIGHT(RC[-2],LEN(RC[-2])-4),IF(LEFT(RC[-2],3)=""RE:"",RIGHT(RC[-2],LEN(RC[-2])-4),RC[-2]))"
.Value = .Value
End If
End With
End Sub