ConfusedFrank
New Member
- Joined
- Mar 13, 2015
- Messages
- 6
Hi,
I have coded a macro that effectively copies a dynamic named range to a sheet called Sales chart. The working named range, called ItemsSold, is a single column consisting of uniquely filtered data.
My problem is the second named range; I want it to look up the source data, called Sales tracking (worksheet), and then sumif each row of itemsSold to find the total number of item sales. I want each of the values returned in the QuantitySold named range (Sales chart).
i know I need to create a loop, but I'm really new to VBA, and I don't know how.
From research, I obtained the following code and amended it to fit my question:
How do I make a macro do this?
If more information is required, please let me know. Thanks in advance.
I have coded a macro that effectively copies a dynamic named range to a sheet called Sales chart. The working named range, called ItemsSold, is a single column consisting of uniquely filtered data.
My problem is the second named range; I want it to look up the source data, called Sales tracking (worksheet), and then sumif each row of itemsSold to find the total number of item sales. I want each of the values returned in the QuantitySold named range (Sales chart).
i know I need to create a loop, but I'm really new to VBA, and I don't know how.
From research, I obtained the following code and amended it to fit my question:
Code:
Dim rng As Range
Dim row As Range
Dim cell As Range
Set rng = Range("ItemsSold")
For Each row In rng.Rows
For Each cell In row.Cells
Sales Chart.Range("B4").Formula = "=SUM(SUMIF('Sales tracking'B2:B16,'Sales chart'!A4,'Sales tracking'!C2:C16)) 'Relative to each item
Next cell
Next row
How do I make a macro do this?
If more information is required, please let me know. Thanks in advance.