![]()
FoundResults: '--------------------------------------------------------------- 'instead of this, need to: 'copy whole rows 2 or 3 times to bottom, put name in col F, look up team col E, 'multiply SALE/COST/GP by percentage in cols K,L,M ' Cells(i, SplitCol).Offset(0, 1) = S1 ' On Error Resume Next ' Cells(i, SplitCol).Offset(0, 2) = S2Array(0, 0) ' On Error GoTo 0 ' Cells(i, SplitCol).Offset(0, 3) = S3 ' Cells(i, SplitCol).Offset(0, 4) = S4 ' Cells(i, SplitCol).Offset(0, 5) = S5 ' On Error Resume Next ' 'final answers in MatchArrayName and MatchArrayNum ' Cells(i, SplitCol).Offset(0, 6) = WorksheetFunction.Trim(MatchArrayName(0, 0)) ' Cells(i, SplitCol).Offset(0, 7) = WorksheetFunction.Trim(MatchArrayName(0, 1)) ' Cells(i, SplitCol).Offset(0, 8) = WorksheetFunction.Trim(MatchArrayName(0, 2)) ' Cells(i, SplitCol).Offset(0, 9) = WorksheetFunction.Trim(MatchArrayNum(0, 0)) ' Cells(i, SplitCol).Offset(0, 10) = WorksheetFunction.Trim(MatchArrayNum(0, 1)) ' Cells(i, SplitCol).Offset(0, 11) = WorksheetFunction.Trim(MatchArrayNum(0, 2)) ' On Error GoTo 0 '--------------------------------------------------------------- '--------------------------------------------------------------- If j > 0 Then '2 way split Rows(i).Copy Destination:=ActiveSheet.Cells(ResultRow, 1) Cells(ResultRow, 6).Value = WorksheetFunction.Trim(MatchArrayName(0, 0)) Cells(ResultRow, 5).Formula = "=VLOOKUP(""" & Cells(ResultRow, 6) & """,'rep names lookup'!A:C,3,0)" Cells(ResultRow, 11).Formula = "=" & Cells(i, 11) & "*" & (Val(WorksheetFunction.Trim(MatchArrayNum(0, 0))) / 100) Cells(ResultRow, 12).Formula = "=" & Cells(i, 12) & "*" & (Val(WorksheetFunction.Trim(MatchArrayNum(0, 0))) / 100) ResultRow = ResultRow + 1 Rows(i).Copy Destination:=ActiveSheet.Cells(ResultRow, 1) Cells(ResultRow, 6).Value = WorksheetFunction.Trim(MatchArrayName(0, 1)) Cells(ResultRow, 5).Formula = "=VLOOKUP(""" & Cells(ResultRow, 6) & """,'rep names lookup'!A:C,3,0)" Cells(ResultRow, 11).Formula = "=" & Cells(i, 11) & "*" & (Val(WorksheetFunction.Trim(MatchArrayNum(0, 1))) / 100) Cells(ResultRow, 12).Formula = "=" & Cells(i, 12) & "*" & (Val(WorksheetFunction.Trim(MatchArrayNum(0, 1))) / 100) ResultRow = ResultRow + 1 End If If j = 2 Then '3 way split Rows(i).Copy Destination:=ActiveSheet.Cells(ResultRow, 1) Cells(ResultRow, 6).Value = WorksheetFunction.Trim(MatchArrayName(0, 2)) Cells(ResultRow, 5).Formula = "=VLOOKUP(""" & Cells(ResultRow, 6) & """,'rep names lookup'!A:C,3,0)" Cells(ResultRow, 11).Formula = "=" & Cells(i, 11) & "*" & (Val(WorksheetFunction.Trim(MatchArrayNum(0, 2))) / 100) Cells(ResultRow, 12).Formula = "=" & Cells(i, 12) & "*" & (Val(WorksheetFunction.Trim(MatchArrayNum(0, 2))) / 100) ResultRow = ResultRow + 1 End If ResultRow = ResultRow + 1 '--------------------------------------------------------------- ResetLine: 'reset everything T1 = False T2 = False T3 = False T4 = False T5 = False S1 = "" S2 = "" S3 = "" S4 = "" S5 = "" Next Set re = Nothing Columns("E:E").Copy Columns("E:E").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False Application.CutCopyMode = False End Sub
Bookmarks