Slicemahn
12-19-2007, 07:24 AM
Hello everyone!
I am trying to write code that will sum cells on a condition being met.
First of all I am three named ranges on a sheet called Summary: CableTotal, WirelessTotal and VOIPTotal all refer to a range.
On my present sheet I have a select case statement for cells here is my code:
Sub FormatandReportAdditions()
Dim Endrow As Long
Dim RowLooper As Long
Endrow = Cells(65536,3).End(xlUp).Row
Cells(6, 7).Value = "Total Calls"
Cells(6, 8).Value = "% Calls Tracked"
For RowLooper = Endrow To 7 Step -1
Select Case Cells(RowLooper, 3).Value
Case Cable
Cells(RowLooper,7).Formula= "=sumif(ThisWorkbook.Names("CallInventory").refertoRange.value,Cells(RowLooper,3).Value,ThisWorkbook.Names("CableTotal").RefertoRange.Value)
Now this is where I get stuck. Should I use an array formula instead?
Please let me know your thoughts.
I am trying to write code that will sum cells on a condition being met.
First of all I am three named ranges on a sheet called Summary: CableTotal, WirelessTotal and VOIPTotal all refer to a range.
On my present sheet I have a select case statement for cells here is my code:
Sub FormatandReportAdditions()
Dim Endrow As Long
Dim RowLooper As Long
Endrow = Cells(65536,3).End(xlUp).Row
Cells(6, 7).Value = "Total Calls"
Cells(6, 8).Value = "% Calls Tracked"
For RowLooper = Endrow To 7 Step -1
Select Case Cells(RowLooper, 3).Value
Case Cable
Cells(RowLooper,7).Formula= "=sumif(ThisWorkbook.Names("CallInventory").refertoRange.value,Cells(RowLooper,3).Value,ThisWorkbook.Names("CableTotal").RefertoRange.Value)
Now this is where I get stuck. Should I use an array formula instead?
Please let me know your thoughts.