Find/then place formula in column C
Posted by Andonny on January 18, 2001 2:00 AM
Hi,
I found the code below and it deletes all rows with the number 13 in culumn A. I was hoping somebody would be able to modify it that whenever it finds 13 in culumn A it puts the formula =A-B in column C instead of deleting the row.
Thanks a lot in advance.
Sub DelRowInCulumn_C()
Dim RowNum As Integer
Dim LastRow, LastCol As Integer
With Worksheets("Sheet1")
LastRow = .UsedRange.Rows.Count
LastCol = .UsedRange.Columns.Count
' Now delete rows if formula in column A is thirteen
For RowNum = LastRow To 1 Step -1
If Range("A" & RowNum).Value = 13 Then
Rows(RowNum).Select
Selection.Delete Shift:=xlUp
End If
Next RowNum
Range("A1").Select
End With
End Sub