Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Sumproduct, array

Could someone help me in modifying the following code running on Excel XP.
1. substitute RC9 with an array "P1","P1D","X1","P1S","U1","A1","X1D" (none
are cell references)
2. Instead of .FormulaR1C1, change to EvaluateR1C1 (to make the lower half
of the code redundant).
3. if the existing code is not to be changed how should I enter the above
array in RC9 onwards on the worksheet to cater for other selections.

Ps. Next to zero knowledge of VBA , I had referred to previous posts but was
not able to adapt any.
Thank you.

Sub Perf1()
ActiveWindow.ActivateNext
Application.Goto Reference:="SALES"
Dim i As Long
For i = 10068 To 10179 Step 8
Cells(i, "J").Resize(7).FormulaR1C1 = _
"=SUMPRODUCT(--(R6C6:R10006C6=RC9),--(R6C5:R10006C5=R10067C),R6C25:R10006C25*RC7)"
Cells(i + 7, "J").FormulaR1C1 = "=SUM(R[-7]C:R[-1]C)"
Next i

Range("J10068:J10179").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
--
Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Sumproduct, array

Seem to have got it. Placed the formula in the first cell. Start record
macro, Press F2 ENTER, Stop record macro. Gave
"=SUMPRODUCT((R6C6:R10006C6={""P1"",""P1D"",""X1"" ,""P1S"",""U1"",""A1"",""X1D""})*((R6C4:R10006C4)= RC[-2])*(R6C25:R10006C25))"
which I substituted on the original code.
--
Robert


"Robert" wrote:

Could someone help me in modifying the following code running on Excel XP.
1. substitute RC9 with an array "P1","P1D","X1","P1S","U1","A1","X1D" (none
are cell references)
2. Instead of .FormulaR1C1, change to EvaluateR1C1 (to make the lower half
of the code redundant).
3. if the existing code is not to be changed how should I enter the above
array in RC9 onwards on the worksheet to cater for other selections.

Ps. Next to zero knowledge of VBA , I had referred to previous posts but was
not able to adapt any.
Thank you.

Sub Perf1()
ActiveWindow.ActivateNext
Application.Goto Reference:="SALES"
Dim i As Long
For i = 10068 To 10179 Step 8
Cells(i, "J").Resize(7).FormulaR1C1 = _
"=SUMPRODUCT(--(R6C6:R10006C6=RC9),--(R6C5:R10006C5=R10067C),R6C25:R10006C25*RC7)"
Cells(i + 7, "J").FormulaR1C1 = "=SUM(R[-7]C:R[-1]C)"
Next i

Range("J10068:J10179").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
--
Robert

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with an array and SUMPRODUCT xlcharlie Excel Worksheet Functions 3 February 9th 10 09:16 PM
Sumproduct array Jumbo Jock[_2_] Excel Worksheet Functions 6 April 8th 09 01:49 AM
Array or SumProduct or other? TMK Excel Worksheet Functions 3 January 15th 08 01:59 PM
CountU from an array - SUMPRODUCT, SUM(IF(...)), both? RobertH Excel Programming 3 October 24th 06 10:33 PM
Another SUMPRODUCT array anomaly Jerry W. Lewis Excel Worksheet Functions 6 May 13th 05 06:42 PM


All times are GMT +1. The time now is 12:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"