Hi All,
I have some code that automatically enters a formula into a cell when a new row is created and it works fine as long as the new row is always the same; 32 in this case.
ActiveCell.Formula = "=IF(M32-M$2<0,""Late"",""Open"")"
M2 is today's date and M32 is the date a document is due.
What I need to do is get the formula to look on the row that it is on...the column will always be 'M'.
It will be part of the following code where it says "Open"
Sub New_Document()
'
' New Document Macro
Application.ScreenUpdating = False
Dim rowPosition As Integer
With Worksheets("MASTER")
rowPosition = .Cells(1, 4).Value
.Rows(rowPosition).EntireRow.Select
Selection.Insert Shift:=x1Down, CopyOrigin:=xlFormatFromRightOrBelow
Rows(rowPosition + 1).Select
Selection.AutoFill Destination:=.Range(.Cells(rowPosition, 1), .Cells(rowPosition + 1, 1)).EntireRow, Type:=xlFillDefault
.Range(.Cells(rowPosition, 2), .Cells(rowPosition, 11)).ClearContents
.Cells(rowPosition, 11).Select
ActiveCell.FormulaR1C1 = "Open"
.Cells(rowPosition, 2).Select
End With
Application.ScreenUpdating = True
End Sub
Bookmarks