swaink
Active Member
- Joined
- Feb 15, 2002
- Messages
- 432
Hi
I wonder of I may seek advice please on how to tweak this code.
VoG kindly provided the solution for me and it works really well. It allows me to enter formulas to the row and in each instance reflects the summary of each column.
Sub Test2()
Dim LR As Long, LC As Long
LR = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
LC = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
Range(Cells(LR + 1, 14), Cells(LR + 1, LC)).Formula = "=SUM(IF(ISNUMBER(N6:N" & LR & "),N6:N" & LR & ",0)/100*$I$6:$I$" & LR & ")"
End Sub
That is it worked well until I changed the line
"Range(Cells(LR + 1, 14), Cells(LR + 1, LC)).Formula = "
to read
"Range(Cells(LR + 1, 14), Cells(LR + 1, LC)).FormulaArray ="
This then freezes all of the formulas entered to column N rather than change as it goes across the sheet.
Could someone advise how I can change this to reflect the column correctly
All the best
Kevin
I wonder of I may seek advice please on how to tweak this code.
VoG kindly provided the solution for me and it works really well. It allows me to enter formulas to the row and in each instance reflects the summary of each column.
Sub Test2()
Dim LR As Long, LC As Long
LR = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
LC = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
Range(Cells(LR + 1, 14), Cells(LR + 1, LC)).Formula = "=SUM(IF(ISNUMBER(N6:N" & LR & "),N6:N" & LR & ",0)/100*$I$6:$I$" & LR & ")"
End Sub
That is it worked well until I changed the line
"Range(Cells(LR + 1, 14), Cells(LR + 1, LC)).Formula = "
to read
"Range(Cells(LR + 1, 14), Cells(LR + 1, LC)).FormulaArray ="
This then freezes all of the formulas entered to column N rather than change as it goes across the sheet.
Could someone advise how I can change this to reflect the column correctly
All the best
Kevin