PDA

View Full Version : Formula in VBA problem



klutz
11-06-2009, 07:21 AM
Good Morning, Afternoon and Evening to all n different time Zones.

I was helped wiht this formula previous here and it works as planned.

I need help to modify it.

What happened is that I inserted a new row above from where the formula is placed and it shifted on me. Now the formula places the value starting on K27 (where originally planned) but since I added a new row i need it to be place on K28.

What do i need to change here to do just that,,,, :bug:


With rngCell
.Offset(3, -2).FormulaR1C1 = _
"=IF(ISERROR(LOOKUP(2,1/((R27C7:R" & lngLastRow & "C7=R[-2]C[2])*(R27C28:R" & _
lngLastRow & "C28=R[1]C)),R27C11:R" & lngLastRow & "C11)),""""," & _
"LOOKUP(2,1/((R27C7:R" & lngLastRow & "C7=R[-2]C[2])*(R27C28:R" & _
lngLastRow & "C28=R[1]C)),R27C11:R" & lngLastRow & "C11))"
.Offset(4, -2).FormulaArray = "=MAX(IF(R27C7:R" & lngLastRow & "C7=R[-3]C[2],R27C28:R" & lngLastRow & "C28))"
End With



Thanks,

The Klutz---

Bob Phillips
11-06-2009, 10:51 AM
I don't understand the question, the formula adjusts just fine.

mbarron
11-06-2009, 11:01 AM
Try changing the Offset from

With rngCell
.Offset(3, -2).FormulaR1C1

to
With rngCell
.Offset(4, -2).FormulaR1C1

This will insert the formula 1 row lower than it is currently being inserted.

klutz
11-08-2009, 05:55 PM
XLD, yes the formula did adjust fine, I just made a mistake. I had another pice of the code mixed up this one. My apologies...

I'm a Klutz:whip me...