I'm trying to nest two loops inside one another with If/Then also.
I need to check a list of data for certain names. When that name is found I need to copy certain data on the same row and paste it elsewhere. I have this set up without any problems but I also need to loop through about 80 cells per line (of data that matches the previous criteria) to find anything that has a value of "N".
I have the first part and loop done but I can't get the section loop to work propertly. Below is my current code for this.
Any help would be much appreciated.
Sub QA_Audits_Move()
Dim xReps As Integer
Dim MaxRow As Integer
Dim AC As Integer
Dim Last As Integer
Dim Insert As Integer
Dim QA As Integer
Dim EBQT As Integer
Dim Crit As Integer
Dim Lastcolumn As Integer
CurRpt = ActiveWorkbook.Name
ShtName = ActiveSheet.Name
Cells(2, 10).Select
RptDateN = Cells(2, 5)
'
' Eric's Team
Cells(1, 1).Select
Selection.End(xlDown).Select
MaxRow = ActiveCell.Row
Cells(1, 3).Select
Selection.End(xlToRight).Select
Lastcolumn = ActiveCell.Column
For xReps = 1 To MaxRow
Cells(xReps, 2).Select
AC = ActiveCell.Row
If (Activecell = "My name") Then
If Cells(AC, 1) = "Manager" Then
Range(Cells(AC, 2), Cells(AC, 6)).Copy
Workbooks("Quality Tracker").Sheets("Eric's Team").Activate
Cells(Rows.Count, 1).End(xlUp)(2).Select
Selection.PasteSpecial xlPasteValues
End If
Workbooks(Format(RptDateN, "MM-DD") & "Master".Activate
For Crit = 6 To Lastcolumn
Cells(AC, 6).Select
If (ActiveCell = 1) Then
Range(Cells(AC, 2), Cells(AC, 6)).Copy
Cells(Rows.Count, 1).End(xlUp)(2).Select
Selection.PasteSpecial xlPasteValues
End If
Next Crit
End If
Next xreps
I need to check a list of data for certain names. When that name is found I need to copy certain data on the same row and paste it elsewhere. I have this set up without any problems but I also need to loop through about 80 cells per line (of data that matches the previous criteria) to find anything that has a value of "N".
I have the first part and loop done but I can't get the section loop to work propertly. Below is my current code for this.
Any help would be much appreciated.
Sub QA_Audits_Move()
Dim xReps As Integer
Dim MaxRow As Integer
Dim AC As Integer
Dim Last As Integer
Dim Insert As Integer
Dim QA As Integer
Dim EBQT As Integer
Dim Crit As Integer
Dim Lastcolumn As Integer
CurRpt = ActiveWorkbook.Name
ShtName = ActiveSheet.Name
Cells(2, 10).Select
RptDateN = Cells(2, 5)
'
' Eric's Team
Cells(1, 1).Select
Selection.End(xlDown).Select
MaxRow = ActiveCell.Row
Cells(1, 3).Select
Selection.End(xlToRight).Select
Lastcolumn = ActiveCell.Column
For xReps = 1 To MaxRow
Cells(xReps, 2).Select
AC = ActiveCell.Row
If (Activecell = "My name") Then
If Cells(AC, 1) = "Manager" Then
Range(Cells(AC, 2), Cells(AC, 6)).Copy
Workbooks("Quality Tracker").Sheets("Eric's Team").Activate
Cells(Rows.Count, 1).End(xlUp)(2).Select
Selection.PasteSpecial xlPasteValues
End If
Workbooks(Format(RptDateN, "MM-DD") & "Master".Activate
For Crit = 6 To Lastcolumn
Cells(AC, 6).Select
If (ActiveCell = 1) Then
Range(Cells(AC, 2), Cells(AC, 6)).Copy
Cells(Rows.Count, 1).End(xlUp)(2).Select
Selection.PasteSpecial xlPasteValues
End If
Next Crit
End If
Next xreps