The code below does what it is supposed to do; it finds “Cash Paid” in Col T and then adds a new row to columns N:AJ
and populates them with formula from the cells above.
But I want to do the same sort of thing in Col Z , with starting cell Z$237 named “Flowers”
BUT ONLY WHEN a value is added in cell Z$238
This is the formula that populates the cell Z$238
In a nut shell; I want Col Z to add and format a new blank cell, ONLY WHEN and IF a new value has been added into eg Z$238
I sincerely hope this makes sense ????
and populates them with formula from the cells above.
VBA Code:
'This will Insert a new Blank Row and places formulas into the new row.
' Then Finds the last used row(looking up from bottom) and inserts Data into next Blank row.
Private Sub cmdAddEntry_Click()
Dim LastRow As Long
Dim LR1 As Long
Dim wt As Worksheet
Set wt = ThisWorkbook.ActiveSheet
Application.ScreenUpdating = False
With wt
LastRow = .Columns("T:T").Find("Cash Paid", , xlFormulas, xlWhole, xlByRows, xlNext, False).Row
LR1 = .Range(.Cells(9, "N"), .Cells(LastRow - 1, "AJ")).Find("*", , xlValues, , xlByRows, xlPrevious).Row
If LR1 = LastRow = 0 Then '(this needs to be 0 otherwise this doesn't work)
.Range("N" & LR1 + 1 & ":AJ" & LR1 + 1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
.Range("N" & LR1 + 1 & ":AJ" & LR1 + 1).FillUp
LastRow = LR1 + 1
End If
BUT ONLY WHEN a value is added in cell Z$238
This is the formula that populates the cell Z$238
VBA Code:
{= IF(SUMPRODUCT(--($R$7:$R103=Z$237))>=ROWS(Z$240:Z240),INDEX($S$7:$S103,SMALL(IF($R$7:$R103=Z$237,ROW($R$7:$R103)-ROW($S$7)+1),ROWS(Z$240:Z240))),"")}
In a nut shell; I want Col Z to add and format a new blank cell, ONLY WHEN and IF a new value has been added into eg Z$238
I sincerely hope this makes sense ????