I am working in a Excel where I look for a name and through VBA pull all the row data associated to them, the info is contained in 3 different Sheets and containing different information but 1 single similarity, the name. Once Data is gather I need for it to display the total/average of the pulled data. This is what I have so far, but it takes more than 30 seconds and it doesn't allow me to add totals
I set already my variables and set each worksheet
Sub siplifydata()
'Declare values
Dim iphws As Worksheet
Dim dataws As Worksheet
Dim ivfnws As Worksheet
Dim ivfpws As Worksheet
Dim agntlg As String
Dim finalrow As Integer 'last row of data
Dim i As Integer 'row counter
'Set values
Set iphws = Sheet1
Set ivfnws = Sheet2
Set ivfpws = Sheet3
Set dataws = Sheet4
agntlg = dataws.Range("F1").Value
For i = 2 To finalrow
If Cells(i, 1) = agntlg Then 'Matches login to name search
Range(Cells(i, 1), Cells(i, 6)).Copy 'copies columns
dataws.Select ' go to report sheet
Range("A50").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues 'finds first blank
iphws.Select ' goes back to continue search
End If
Next i
dataws.Select
ivfnws.Select
For i = 2 To finalrow
If Cells(i, 1) = agntlg Then 'Matches login to name search
Range(Cells(i, 1), Cells(i, 6)).Copy 'copies columns
dataws.Select ' go to report sheet
Range("H50").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues 'finds first blank
ivfnws.Select ' goes back to continue search
End If
Next i
dataws.Select
ivfpws.Select
For i = 2 To finalrow
If Cells(i, 1) = agntlg Then 'Matches login to name search
Range(Cells(i, 1), Cells(i, 6)).Copy 'copies columns
dataws.Select ' go to report sheet
Range("O50").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues 'finds first blank
ivfpws.Select ' goes back to continue search
End If
Next i
dataws.Select