I am using vba to get lists of the different accounts with different currencies. To do this I am using a normal filter to select the currency and then an advanced filter to pick out all the accounts for that currency. It then pastes the list on a sheet called Accts.
The spreadsheet has over 30,000 lines of info and is very slow is there anyway of doing it faster. My code is below. I think it works but just takes forever.
Sub Filtering()
Application.ScreenUpdating = False
intLastRow = Worksheets("report").Cells(Rows.Count, "b").End(xlUp).Row
intLastCol = Worksheets("info sheet").Cells(Columns.Count, 7).Column
Set rngAdvFilter = Worksheets("report").Range("b7:m" & intLastRow)
Set rngCriteria = Worksheets("report").Range("d7:d" & intLastRow)
Set rRange = Worksheets("info sheet").Range("c7:m7")
For Each rCell In rRange
strCurrency = rCell.Value
With rngAdvFilter
.AutoFilter Field:=6, Criteria1:= _
"=" & strCurrency, Operator:=xlAnd 'filtering on currency so we are
'looking for all accounts on a certain currency
End With
Worksheets("accts").Select
Range("b1:aa1").Select
Selection.find(What:=strCurrency, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Set rngPaste = ActiveCell.Offset(1, 0)
rngPaste.Select
Worksheets("report").Select
Range("D7:D" & intLastRow).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"P7"), Unique:=True
intLastRow2 = Worksheets("report").Cells(Rows.Count, "p").End(xlUp).Row
Set rngResults = Worksheets("report").Range("P8:P" & intLastRow2)
rngResults.Copy
rngPaste.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
rngResults.ClearContents
If Worksheets("report").FilterMode Then
Worksheets("report").ShowAllData
End If
Next rCell
Application.ScreenUpdating = True
End Sub