I need this to go through all if statements before it loops. The macro look at the one if statement and goes to the end and loops. I need the macro to do mutliple if statements first then increment and loop. Any suggestions on how to do this.
'Output into destination sheet
Sheets("data").Select
Range("A1:A400").AdvancedFilter xlFilterInPlace, CriteriaRange:=Range("A1:A400"), Unique:=True
Columns("A:A").Select
Selection.Copy
Sheets("Main Page").Select
Range("B1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Sheets("data").ShowAllData
Do
Set myrange = Sheets(destsh).Range(output(13))
p = p + 1
m = p + 1
vRet = Application.WorksheetFunction.VLookup(myrange, Worksheets("data").Range("A2:G300"), 2, False)
reportlocation = "A" + m 'partnumber
Sheets(destsh).Range(reportlocation) = vRet
If UCase(Trim(Sheets(sh).Range(TestRange3))) = UCase(Trim(Sheets(destsh).Range(output(13)))) And UCase(Trim(Sheets(sh).Range(TestRange))) = UCase(Trim(Sheets(destsh).Range(output(9)))) Then
reportlocation = "D" + m 'TP
Sheets(destsh).Range(reportlocation) = strvar1
ElseIf UCase(Trim(Sheets(sh).Range(TestRange3))) = UCase(Trim(Sheets(destsh).Range(output(13)))) And UCase(Trim(Sheets(sh).Range(TestRange))) = UCase(Trim(Sheets(destsh).Range(output(5)))) Then
reportlocation = "E" + m 'ROLL
Sheets(destsh).Range(reportlocation) = strvar1
End If
n = n + 1
TestRange3 = "A" + n
TestRange = "E" + n
output(1) = "A" + n
output(13) = "B" + n
Loop Until Sheets(destsh).Range(output(13)) = ""
'Output into destination sheet
Sheets("data").Select
Range("A1:A400").AdvancedFilter xlFilterInPlace, CriteriaRange:=Range("A1:A400"), Unique:=True
Columns("A:A").Select
Selection.Copy
Sheets("Main Page").Select
Range("B1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Sheets("data").ShowAllData
Do
Set myrange = Sheets(destsh).Range(output(13))
p = p + 1
m = p + 1
vRet = Application.WorksheetFunction.VLookup(myrange, Worksheets("data").Range("A2:G300"), 2, False)
reportlocation = "A" + m 'partnumber
Sheets(destsh).Range(reportlocation) = vRet
If UCase(Trim(Sheets(sh).Range(TestRange3))) = UCase(Trim(Sheets(destsh).Range(output(13)))) And UCase(Trim(Sheets(sh).Range(TestRange))) = UCase(Trim(Sheets(destsh).Range(output(9)))) Then
reportlocation = "D" + m 'TP
Sheets(destsh).Range(reportlocation) = strvar1
ElseIf UCase(Trim(Sheets(sh).Range(TestRange3))) = UCase(Trim(Sheets(destsh).Range(output(13)))) And UCase(Trim(Sheets(sh).Range(TestRange))) = UCase(Trim(Sheets(destsh).Range(output(5)))) Then
reportlocation = "E" + m 'ROLL
Sheets(destsh).Range(reportlocation) = strvar1
End If
n = n + 1
TestRange3 = "A" + n
TestRange = "E" + n
output(1) = "A" + n
output(13) = "B" + n
Loop Until Sheets(destsh).Range(output(13)) = ""