Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function CountCellsByColor(rData As Range, cellRefColor As Range) As Long
- ' Функция считает количество ячеек выбранного цвета
- Dim indRefColor As Long
- Dim cellCurrent As Range
- Dim cntRes As Long
- Application.Volatile
- cntRes = 0
- indRefColor = cellRefColor.cells(1, 1).Interior.Color
- For Each cellCurrent In rData
- If indRefColor = cellCurrent.Interior.Color Then
- cntRes = cntRes + 1
- End If
- Next cellCurrent
- CountCellsByColor = cntRes
- End Function
- Function CountCellsByFontBold(rData As Range) As Integer
- Dim count As Integer
- Dim cell As Range
- For Each cell In rData
- If cell.Font.Bold = True Then
- CountCellsByFontBold = CountCellsByFontBold + 1
- End If
- Next cell
- End Function
- Function CountBungedPeople(Диапазон As Range, СсылкаНаЦвет As Range) As Integer
- ' Функция предназначена для подсчета количества студентов, обучающихся на бюджете
- ' Принипает в себя два аргумента: диапазон значений (диапазаон студентов) и ячейку с цветом, обозначающий, что студент выбыл
- Dim count As Integer
- Dim cellCurrent As Range
- Dim refColor As Long
- Application.Volatile
- count = 0
- refColor = СсылкаНаЦвет.cells(1, 1).Interior.Color
- For Each cellCurrent In Диапазон
- If cellCurrent.Font.Bold = False Then
- count = count + 1
- If refColor = cellCurrent.Interior.Color Then
- count = count - 1
- End If
- End If
- Next cellCurrent
- CountBungedPeople = count
- End Function
- Function CountCommercialPeople(Диапазон As Range, СсылкаНаЦвет As Range) As Integer
- ' Функция предназначена для подсчета количества студентов, обучающихся на коммерции
- ' Принипает в себя два аргумента: диапазон значений (диапазаон студентов) и ячейку с цветом, обозначающий, что студент выбыл
- Dim count As Integer
- Dim cellCurrent As Range
- Dim refColor As Long
- Application.Volatile
- count = 0
- refColor = СсылкаНаЦвет.cells(1, 1).Interior.Color
- For Each cellCurrent In Диапазон
- If cellCurrent.Font.Bold = True Then
- count = count + 1
- If refColor = cellCurrent.Interior.Color Then
- count = count - 1
- End If
- End If
- Next cellCurrent
- CountCommercialPeople = count
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement