У меня есть эта таблица:
Для каждого из секторов (ИТ, потребительский, финансовый и т. Д.) Я хочу добавить инвестированный% и вернуть итоговый результатценности.Например, ИТ должно вернуть 7% (1 + 2 + 4), а здравоохранение должно вернуть 24% (7 + 8 + 9).
Это то, что я имею до сих пор:
Dim sector_array As Variant
Dim sector As Variant
Dim ocell As Range
Dim rng As Range
sector_array = Array("Information Technology", "Financials", "Consumer
Discretionary", "Energy", "Materials", "Consumer Staples", "Health Care",
"Industrials", "Utilities", "Telecommunication Services", "Real Estate")
For Each sector In sector_array
For Each ocell In Range("C:C")
If ocell.Value = sector Then
If rng Is Nothing Then
Set rng = ocell.EntireRow
Else
Set rng = Union(rng, ocell.EntireRow)
End If
End If
Next ocell
If Not rng Is Nothing Then
rng.Select
End If
Next sector
Как бы мне этого добиться?