Count on one sheet list on other?
Posted by Joe Was on June 04, 2001 6:52 AM
On sheet2 is a column of names. On sheet1 the sorted list of unique names get posted. Every thing I try to get the number of times each name on sheet2 is listed on sheet1 fails?
'Problem code!
Set tallyRange = Worksheets("Sheet2").Range(Range("I1"), Range("I1").End(xlDown)).Offset(0, 1)
Set fillRange = Worksheets("Sheet1").Range("J1")
With Worksheets("Sheet2").Range("J1")
'Count occurrences of names on Sheet2.
.Formula = "=CountIf(" & Intersect(Columns(8), ActiveSheet.UsedRange).Address & ",I1)"
.AutoFill Destination:=Range(fillRange.Address)
End With
With tallyRange
'List the number of times each unique name occurred on Sheet2, next to the list on sheet1.
.Copy Destination:=Range(fillRange.Address)
.PasteSpecial (xlValues)
End With
Application.CutCopyMode = False
Application.ScreenUpdating = True
Sheets("Sheet1").Select
Range("A1").Select
End Sub
Any ideas with this form button code? Thank's. JSW