Can anyone shed some light on how to find the intersection of one named range with other named ranges?
My thought was to loop through the named ranges excluding the common one, and add them to an array. I haven't found how to do this.
Here is the code, including all my thoughts and attempts.
The section with, For Each num In Range("Qty") works. This is the formula I want to apply to all ranges that intersect with the dynamic 'Qty' range defined in a single column.
Any assistance is greatly appreciated.
Best,
Brad
My thought was to loop through the named ranges excluding the common one, and add them to an array. I haven't found how to do this.
Here is the code, including all my thoughts and attempts.
The section with, For Each num In Range("Qty") works. This is the formula I want to apply to all ranges that intersect with the dynamic 'Qty' range defined in a single column.
Code:
Dim theName As Range
Sub TrueCost()
Dim num As Variant, A As Variant, B As Variant, C As Variant
'Dim theName As Range
For Each Name In ThisWorkbook.Names
rngNames (Name)
Next
'For Each num In Range("Qty")
'num.Offset(1, -1).Value = (num.offset(0,1).value * range("G2") /_
100 + num.offset(0,1).value) / num.offset(0,0).value + range("H2") /_
count(offset($D$2,0,0,count($A:$A),0))
'A = (num.Offset(1, 1).Value * Range("G2").Value / 100 +_
num.Offset(1, 1).Value) / num.Offset(1, 0).Value + Range("H2") /_
Range("Qty").Offset(1, 0).Cells.SpecialCells(xlCellTypeConstants).Count
'B = Range("Qty").Rows(num.Offset(1, 0, 0, Range("Qty").Count, 0))
'C = Range("Qty").Offset(1, 0).Cells.SpecialCells(xlCellTypeConstants).Count
'MsgBox "Value = " & A
'Next
End Sub
Sub rngNames(theName)
Dim R As Range
Dim RN As Name
Set RN = ThisWorkbook.Names(theName)
On Error Resume Next
Set R = RN.RefersToRange
Debug.Print R
End Sub
Best,
Brad
Last edited: