Sub Test()
Dim Masterworksht As Worksheet
Dim Oworksht As Worksheet
Dim intRow, intMRow, intH, intNor, intL, intClosed As Integer
Set Masterworksht = ThisWorkbook.Worksheets("Master")
Set Oworksht = ThisWorkbook.Worksheets("Output")
intRow = 4
Do
intH = 0
intNor = 0
intL = 0
intClosed = 0
intMRow = 3
Do
If (Oworksht.Cells(intRow, 1).Value = Masterworksht.Cells(intMRow, 2).Value) Then
If (Masterworksht.Cells(intMRow, 8).Value = "High") Then
intH = intH + 1
ElseIf (Masterworksht.Cells(intMRow, 8).Value = "Low") Then
intL = intL + 1
ElseIf (Masterworksht.Cells(intMRow, 8).Value = "Normal") Then
intNor = intNor + 1
End If
If (Masterworksht.Cells(intMRow, 12).Value = "Closed") Then
intClosed = intClosed + 1
End If
End If
intMRow = intMRow + 1
Loop While Masterworksht.Cells(intMRow, 1).Value <> ""
Oworksht.Cells(intRow, 2).Value = intH
Oworksht.Cells(intRow, 3).Value = intNor
Oworksht.Cells(intRow, 4).Value = intL
Oworksht.Cells(intRow, 6).Value = intClosed
intRow = intRow + 1
Loop While Oworksht.Cells(intRow, 1).Value <> ""
End Sub
Вы также можете использовать эту формулу в УВА как 'Count = WorksheetFunction.CountIf (...)'. –
Я действительно новичок в VBA Macro. Не могли бы вы помочь мне полностью написать код. Ниже приведена таблица: Страны \t Сотрудника США \t США \t б США \t с США \t д США \t х США \t е Канады \t г Канады \t ч Канада \t я Канады \t Канада \t b Канада \t c Канада \t d Англия \t х Англии \t х Англия \t г Англии \t ч Англии \t я Англии \t Англия \t б –
Покажите мне вашу формулу первенствовать. –