ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Consolidate ...problem (https://www.excelbanter.com/excel-programming/339135-consolidate-problem.html)

Arishy[_2_]

Consolidate ...problem
 
Public Sub consolidatewithatwist()
Dim myArray As Variant

Sheets("aaa").Range("a25:f32").Name = "Rng1"
Sheets("bbb").Range("a25:f32").Name = "Rng2"
Sheets("ccc").Range("a25:f32").Name = "Rng3"


myArray = Array("Rng1", "Rng2", "Rng3")

Sheets("AveragePriceFlowers").Select
Range("A10").Select
Cells.Clear
Range("a10").Consolidate Sources:=myArray, Function:=xlSum,
TopRow:=True, LeftColumn:= _
True, CreateLinks:=False


End Sub

Each range(Identical) consists of
ItemCode/Description/field3/field4/field5/Quantity
Variable rows between 3-10 rows

Here what I get

The items summarized correctly ie I get "unique" item codes
The quantity field summarized correctly
The Description Dissapears from all summarized rows
Also I get Fields3-5 Also summed.

Is this the expected behaviour ? and how I can get the description And
prevent fields3-5 from being summarized Examples of these fields: unit
price !!! no sense getting a sum for ...



All times are GMT +1. The time now is 09:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com