Thread: [Solved] HLOOKUP, if,? OR MACRO
View Single Post
 
Old 04-11-2011, 10:38 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,340
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Bobby,

With your raw data in Sheet 1 and the list of welders in Sheet2 (col A), you could use the following macro:
Code:
Sub Summarize()
Application.ScreenUpdating = False
Dim i As Long, j As Long, k As Long
Dim StrName As String, iTally As Long
With ThisWorkbook.Sheets("Sheet2")
  For i = 2 To .Range("A" & .Rows.Count).End(xlUp).Row
    StrName = .Range("A" & i).Value
    iTally = 0
    With ThisWorkbook.Sheets("Sheet1")
      For j = 2 To .Range("A" & .Rows.Count).End(xlUp).Row
        For k = 2 To .Cells.SpecialCells(xlCellTypeLastCell).Column
          If .Cells(j, k).Value = StrName Then
            iTally = iTally + 1
            Exit For
          End If
        Next
      Next
    End With
    .Range("B" & i).Value = iTally
  Next
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote