Attached workbook goes into non-response mode when asked to set the filter on the DATABASE sheet, and eventually I have to close Excel, but can't see why?
DATABASE worksheet lists names, test dates and results across four tests for Jan - April.
Macro needs to start by filtering Col A of the DATABASE by the Name selected from the DropList in C2 of the PERFORMANCE worksheet, then Transpose the dates and scores into Cols C - F of the PERFORMANCE worksheet.
End result should be as shown in Cols I - M, if Candidate 1 is selected.
But I can't even get it to complete the first step (Filter the Database to show only the name selected).
Option Explicit
Dim f As Long, lngCnt As Long
Dim rng As Range, cell As Range
Dim arrList() As String
Dim ws As Worksheet, ws2 As Worksheet
Sub PlayerPerf()
Set ws = Sheet1
Set ws2 = Sheet2
'Find last row in Database
With ws2
f = .Cells(.Rows.Count, "A").End(xlUp).Row
If f < 2 Then f = 2
Set rng = .Range("A2:A" & f)
'Load values into an array
lngCnt = 0
For Each cell In rng
ReDim Preserve arrList(lngCnt)
arrList(lngCnt) = cell.Text
lngCnt = lngCnt + 1
Next
If .FilterMode Then .ShowAllData
.Range("A2:A" & f).AutoFilter Field:=1, Criteria1:=ws.Cells(2, 3), Operator:=xlFilterValues
End With
End Sub
All solutions, suggestions and alternatives welcome as ever
Ochimus
Bookmarks