Help adding deletion of rows before sorting?

cspengel

Board Regular
Joined
Oct 29, 2022
Messages
173
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I am using some code I found that generates combinations, and have made a few adjustments to fit my needs. (other calculations to help filter the data). Everything works as intended however I would like to know how I can delete rows based on cell value. What I am trying to do is delete rows before sorting to optimize how long it takes for the macro to process. If I can delete the the rows where the sum is greater than 60,000, I would save a lot of time. The sorting function takes over 40 minutes sometimes due to the amount of combinations. Then after the macro is done for example, I may only need 200-1000 combinations out of 500,000.

The sort function is highlighted in red and the sum function is highlighted in blue. Thanks for any feedback.

VBA Code:
Public CalcState As Long
Public EventState As Boolean
Public PageBreakState As Boolean

Sub OptimizeCode_Begin()

Application.ScreenUpdating = False

EventState = Application.EnableEvents
Application.EnableEvents = False

CalcState = Application.Calculation
Application.Calculation = xCalculationManual

PageBreakState = ActiveSheet.DisplayPageBreaks
ActiveSheet.DisplayPageBreaks = False

End Sub

Sub OptimizeCode_End()

ActiveSheet.DisplayPageBreaks = PageBreakState
Application.Calculation = CalcState
Application.EnableEvents = EventState
Application.ScreenUpdating = True

End Sub


Sub NameCombos()
    'https://www.mrexcel.com/forum/excel-questions/1106189-all-combinations-multiple-columns-without-duplicates.html
    
    Dim lLastColumn As Long
    Dim lLastUsedColumn As Long
    Dim aryNames As Variant
    Dim lColumnIndex As Long
    Dim lWriteRow As Long
    Dim bCarry As Boolean
    Dim lWriteColumn As Long
    Dim rngWrite As Range
    Dim lFirstWriteColumn As Long
    Dim lLastWriteColumn As Long
    Dim oFound As Object
    Dim lRefColumn As Long
    Dim lInUseRow As Long
    Dim lCarryColumn As Long
    Dim lPrint As Long
    Dim lLastIteration As Long
    Dim lIterationCount As Long
    Dim sErrorMsg As String
    Dim bShowError As Boolean
    Dim lLastRow As Long
    Dim lLastRowDeDuped As Long
    Dim aryDeDupe As Variant

    Dim sName As String
    Dim bDupeName As Boolean
    
    Dim oSD As Object
    Dim rngCell As Range
    Dim varK As Variant, varI As Variant, varTemp As Variant, lIndex As Long
    Dim lRowIndex As Long
    Dim lRowIndex2 As Long
    Dim rngSortRange As Range
    Dim dteStart As Date
    Dim sOutput As String
    Dim lFirstHSortColumn As Long
    Dim lFirstHSortColumn2 As Long
    Dim lFirstHTeamCol As Long
    Dim firstrow As Long
    Dim v
    Dim lLastHTeamCol As Long
    Dim currow As Long
    Dim diff As Long
    Dim lLastHSortColumn As Long
    Dim lLastHSortColumn2 As Long
    Dim lLastSalaryRow As Long
    Dim rngReplace As Range
    Dim wks As Worksheet
    Dim bFoundSalary As Boolean
    Dim sMissingSalary As String
    
    Call OptimizeCode_Begin
    
    Application.StatusBar = False
    
    'Check for salary worksheet
    For Each wks In ThisWorkbook.Worksheets
        If wks.Name = "Salary" Then bFoundSalary = True
    Next
    If Not bFoundSalary Then
        MsgBox "The workbook must contain a worksheet named 'Salary' with data starting in row 2 " & _
            "that consists of column A containing each name in the name/column layout worksheet " & _
            "and column B containng their salary."
        GoTo End_Sub
    End If
    
    'Make sure each name has a corresponding salary entry
    'Initialize the scripting dictionary
    Set oSD = CreateObject("Scripting.Dictionary")
    oSD.CompareMode = vbTextCompare
    'Inventory names on the main worksheet
    For Each rngCell In ActiveSheet.Range("A1").CurrentRegion.Offset(1, 0)
        rngCell.Value = Trim(rngCell.Value)
        If rngCell.Value <> vbNullString Then
            oSD.Item(rngCell.Value) = oSD.Item(rngCell.Value) + 1
        End If
    Next
    'Remove names on the Salary worksheet
    With Worksheets("Salary")
        For Each rngCell In .Range("A2:A" & .Cells(Rows.Count, 1).End(xlUp).Row)
            rngCell.Value = Trim(rngCell.Value)
            If oSD.exists(rngCell.Value) Then
                oSD.Remove rngCell.Value
            End If
        Next
    End With
    
    'Any names not accounted for?
    If oSD.Count <> 0 Then
        varK = oSD.keys
        For lIndex = LBound(varK) To UBound(varK)
            sMissingSalary = sMissingSalary & ", " & varK(lIndex)
        Next
        sMissingSalary = Mid(sMissingSalary, 3)
        sOutput = "The following names on the main worksheet do not have a corresponding entry on the 'Salary' worksheet." & vbLf & vbLf & _
            sMissingSalary
        MsgBox sOutput
        Debug.Print sOutput
        GoTo End_Sub
    End If
    
    sErrorMsg = "Ensure a Worksheet is active with a header row starting in A1" & _
        "and names under each header entry."
    
    If TypeName(ActiveSheet) <> "Worksheet" Then
        bShowError = True
    End If
    
    If bShowError Then
        MsgBox sErrorMsg, , "Problems Found in Data"
        GoTo End_Sub
    End If
    
    lLastColumn = Range("A1").CurrentRegion.Columns.Count
    lLastUsedColumn = ActiveSheet.UsedRange.Columns.Count
    ReDim aryNames(1 To 2, 1 To lLastColumn)    '1 holds the in-use entry row
                                                
    'How many combinations? (Order does not matter)
    lLastIteration = 1
    For lColumnIndex = 1 To lLastColumn
        aryNames(1, lColumnIndex) = 2
        aryNames(2, lColumnIndex) = Cells(Rows.Count, lColumnIndex).End(xlUp).Row
        lLastIteration = lLastIteration * (aryNames(2, lColumnIndex) - 1)
    Next
    
    lRefColumn = lLastColumn + 1
    lFirstWriteColumn = lLastColumn + 2
    lLastWriteColumn = (2 * lLastColumn) + 1
    
    Select Case MsgBox("Process a " & lLastColumn & " column table with " & _
        lLastIteration & " possible combinations?" & vbLf & vbLf & _
        "WARNING: Columns right of the input range will be erased before continuing.", vbOKCancel + vbCritical + _
        vbDefaultButton2, "Process table?")
    Case vbCancel
        GoTo End_Sub
    End Select
    
    dteStart = Now()
    
    'Clear all columns right of input range
    If lLastUsedColumn > lLastColumn Then
        Range(Cells(1, lLastColumn + 1), Cells(1, lLastUsedColumn)).EntireColumn.ClearContents
    End If
    Cells(1, lLastWriteColumn + 1).Value = "ComboID"
    
    'Add Output Header
    Range(Cells(1, 1), Cells(1, lLastColumn)).Copy Destination:=Cells(1, lFirstWriteColumn)
    
    'Start checking combinations
    lWriteRow = 2
    For lIterationCount = 1 To lLastIteration
        If lIterationCount / 1000 = lIterationCount \ 1000 Then Application.StatusBar = _
            lIterationCount & " / " & lLastIteration
            
        'Reset the Dupe Name flag
        bDupeName = False
        
        'Check Active Combo for Dupe Names
        'Initialize the scripting dictionary
        Set oSD = CreateObject("Scripting.Dictionary")
        oSD.CompareMode = vbTextCompare
        
        'Load names into scripting dictionary
        For lColumnIndex = lLastColumn To 1 Step -1
            sName = Cells(aryNames(1, lColumnIndex), lColumnIndex).Value
            oSD.Item(sName) = oSD.Item(sName) + 1
        Next
        
        'If there are names, and at least one duplicate, set the bDupeName flag
        If oSD.Count > 0 Then
            varK = oSD.keys
            varI = oSD.Items
            For lIndex = 1 To oSD.Count
                If varI(lIndex - 1) > 1 Then
                    bDupeName = True: Exit For
                End If
            Next
        End If
        
        
        If Not bDupeName Then
            'The current row had names and no duplicates
            'Print Active Combo to the lWriteRow row
            For lColumnIndex = lLastColumn To 1 Step -1
                lWriteColumn = lColumnIndex + lLastColumn + 2
                Set rngWrite = Range(Cells(lWriteRow, lFirstWriteColumn), Cells(lWriteRow, lLastWriteColumn))
                Cells(lWriteRow, lRefColumn + lColumnIndex).Value = Cells(aryNames(1, lColumnIndex), lColumnIndex).Value
            Next
            
            'Uncomment next row to see the lIterationCount for the printed row
            Cells(lWriteRow, lLastWriteColumn + 1).Value = lIterationCount
            
            'Point to the next blank row
            lWriteRow = lWriteRow + 1
            
        End If
    
        'Increment Counters
        'Whether the line had duplicates or not, move to the next name in the
        '  rightmost column, if it was ag the last name, go to the first name in that column and
        '  move the name in the column to the left down to the next name (recursive check if THAT
        '  column was already using the last name for remaining columns to the left)
        aryNames(1, lLastColumn) = aryNames(1, lLastColumn) + 1
        If aryNames(1, lLastColumn) > aryNames(2, lLastColumn) Then
            bCarry = True
            lCarryColumn = lLastColumn
            Do While bCarry = True And lCarryColumn > 0
                aryNames(1, lCarryColumn) = 2
                bCarry = False
                lCarryColumn = lCarryColumn - 1
                If lCarryColumn = 0 Then Exit Do
                aryNames(1, lCarryColumn) = aryNames(1, lCarryColumn) + 1
                If aryNames(1, lCarryColumn) > aryNames(2, lCarryColumn) Then bCarry = True
            Loop
        End If
        
        'Check counter values (for debug)
'        Debug.Print lWriteRow,
'        For lPrint = 1 To lLastColumn
'            Debug.Print aryNames(1, lPrint) & ", ";
'        Next
'        Debug.Print
        DoEvents
    Next
    
    Application.StatusBar = "Sorting"
    Application.ScreenUpdating = False
    
    'Copy row names to right so that each copied row can be sorted alphabetically left to right
    '  this will allow the Excel remove duplicate fuction to remove rows that have identical names
    '  in all of their sorted columns.
    lLastRow = Cells(Rows.Count, lFirstWriteColumn).End(xlUp).Row
    Range(Cells(1, lFirstWriteColumn), Cells(lLastRow, lLastWriteColumn)).Copy Destination:=Cells(1, lLastWriteColumn + 2) ''SALARY
    lFirstHSortColumn = lLastWriteColumn + 2
    lLastHSortColumn = Cells(1, Columns.Count).End(xlToLeft).Column
    
    Range(Cells(1, lFirstWriteColumn), Cells(lLastRow, lLastWriteColumn)).Copy Destination:=Cells(1, lLastHSortColumn + 1) ''PROJECTION
    lFirstHSortColumn2 = lLastHSortColumn + 1
    lLastHSortColumn2 = Cells(1, Columns.Count).End(xlToLeft).Column
     
    Range(Cells(1, lFirstWriteColumn), Cells(lLastRow, lLastWriteColumn)).Copy Destination:=Cells(1, lLastHSortColumn2 + 1) ''TEAM
    lFirstHTeamCol = lLastHSortColumn2 + 1
    lLastHTeamCol = Cells(1, Columns.Count).End(xlToLeft).Column
     
    [COLOR=rgb(226, 80, 65)]'Sort each row
    Application.ScreenUpdating = False
    lLastRow = Cells(Rows.Count, lFirstWriteColumn).End(xlUp).Row
    For lRowIndex = 2 To lLastRow
        Set rngSortRange = Range(Cells(lRowIndex, lFirstHSortColumn), Cells(lRowIndex, lLastHSortColumn))
        ActiveSheet.Sort.SortFields.Clear
        ActiveSheet.Sort.SortFields.Add Key:=rngSortRange, _
            SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
        With ActiveSheet.Sort
            .SetRange rngSortRange
            .Header = xlNo
            .MatchCase = False
            .Orientation = xlLeftToRight
            .SortMethod = xlPinYin
            .Apply
        End With
    Next[/COLOR]
    
    'Check for duplicate rows in HSort Columns
    '  Can only happen if names are duplicated within an input column
    '  Build aryDeDupe  -- Array(1, 2, 3,...n)  -- to exclude iteration # column

    lLastRow = Cells(Rows.Count, lFirstWriteColumn).End(xlUp).Row
    ReDim aryDeDupe(0 To lLastHSortColumn - lFirstHSortColumn)
    lIndex = 0
    For lColumnIndex = lFirstHSortColumn To lLastHSortColumn
        aryDeDupe(lIndex) = CInt(lColumnIndex - lFirstWriteColumn + 1)
        lIndex = lIndex + 1
    Next
    ActiveSheet.Cells(1, lFirstWriteColumn).CurrentRegion.RemoveDuplicates Columns:=(aryDeDupe), Header:=xlYes
    'Above line won't work unless there are parens around the Columns argument ?????
    
    lLastRowDeDuped = Cells(Rows.Count, lFirstWriteColumn).End(xlUp).Row
    
    'Assumes the 'Salary' worksheet has names in the column A and salaries in column B starting in row 2
    'Replace HSort names with salary
    With Worksheets("Salary") '''' SALARY
        lLastSalaryRow = .Cells(.Rows.Count, 1).End(xlUp).Row
    End With
    Set rngReplace = Range(Cells(2, lFirstHSortColumn), Cells(lLastRow, lLastHSortColumn))
    For lRowIndex = 2 To lLastSalaryRow
        rngReplace.Replace What:=Worksheets("Salary").Cells(lRowIndex, 1).Value, _
            Replacement:=Worksheets("Salary").Cells(lRowIndex, 2).Value, LookAt:=xlWhole, _
            SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
            ReplaceFormat:=False
     Next
     '''''''''''''''''''''''''''''''''''''PROJECTION
     With Worksheets("Salary")
        lLastSalaryRow = .Cells(.Rows.Count, 1).End(xlUp).Row
    End With
    Set rngReplace = Range(Cells(2, lFirstHSortColumn2), Cells(lLastRow, lLastHSortColumn2))
    For lRowIndex2 = 2 To lLastSalaryRow
        rngReplace.Replace What:=Worksheets("Salary").Cells(lRowIndex2, 1).Value, _
            Replacement:=Worksheets("Salary").Cells(lRowIndex2, 3).Value, LookAt:=xlWhole, _
            SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
            ReplaceFormat:=False
    Next '''''''''''''''''''''''''''
    
         '''''''''''''''''''''''''''''''''''''TEAM
     With Worksheets("Salary")
        lLastSalaryRow = .Cells(.Rows.Count, 1).End(xlUp).Row
    End With
    Set rngReplace = Range(Cells(2, lFirstHTeamCol), Cells(lLastRow, lLastHTeamCol))
    For lRowIndex2 = 2 To lLastSalaryRow
        rngReplace.Replace What:=Worksheets("Salary").Cells(lRowIndex2, 1).Value, _
            Replacement:=Worksheets("Salary").Cells(lRowIndex2, 4).Value, LookAt:=xlWhole, _
            SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
            ReplaceFormat:=False
    Next '''''''''''''''''''''''''''
    
    [COLOR=rgb(44, 130, 201)]'Add Sum Column
   Cells(1, lLastHTeamCol + 1).Value = ChrW(931) & " Salary"
    With Range(Cells(2, lLastHTeamCol + 1), Cells(lLastRowDeDuped, lLastHTeamCol + 1))
        .FormulaR1C1 = "=SUM(RC" & lFirstHSortColumn & ":RC" & lLastHSortColumn & ")"
        Application.Calculate
        .Value = .Value
    End With[/COLOR]
    
    ''Add Projection Column
    Cells(1, lLastHTeamCol + 2).Value = ChrW(931) & " Projection"
    With Range(Cells(2, lLastHTeamCol + 2), Cells(lLastRowDeDuped, lLastHTeamCol + 2))
        .FormulaR1C1 = "=SUM(RC" & lFirstHSortColumn2 & ":RC" & lLastHSortColumn2 & ")"
        Application.Calculate
        .Value = .Value
    End With
    
     ''Add Team Stack Column
    Cells(1, lLastHTeamCol + 3).Value = ChrW(931) & " Stack"
    With Range(Cells(2, lLastHTeamCol + 3), Cells(lLastRowDeDuped, lLastHTeamCol + 3))
        .FormulaR1C1 = "=INDEX(RC" & lFirstHTeamCol & ":RC" & lLastHTeamCol & ",MODE(MATCH(RC" & lFirstHTeamCol & ":RC" & lLastHTeamCol & ",RC" & lFirstHTeamCol & ":RC" & lLastHTeamCol & ",0)))"
        Application.Calculate
        .Value = .Value
    End With
    
    ''Add Team Stack Pos
    Cells(1, lLastHTeamCol + 4).Value = ChrW(931) & " Stack POS"
    With Range(Cells(2, lLastHTeamCol + 4), Cells(lLastRowDeDuped, lLastHTeamCol + 4))
    
    .Formula2R1C1 = "=TEXTJOIN("","",1,IF(RC[-12]:RC[-4]=RC[-1],R1C[-12]:R1C[-4],""""))"
        Application.Calculate
        .Value = .Value
    End With
    
    ''Add 2nd Team Stack Column
    Cells(1, lLastHTeamCol + 5).Value = ChrW(931) & " Stack2"
    With Range(Cells(2, lLastHTeamCol + 5), Cells(lLastRowDeDuped, lLastHTeamCol + 5))
        .Formula2R1C1 = "=IFERROR(INDEX(RC[-13]:RC[-5],MODE(IF((RC[-13]:RC[-5]<>"""")*(RC[-13]:RC[-5]<>INDEX(RC[-13]:RC[-5],MODE(IF(RC[-13]:RC[-5]<>"""",MATCH(RC[-13]:RC[-5],RC[-13]:RC[-5],0))))),MATCH(RC[-13]:RC[-5],RC[-13]:RC[-5],0)))),"""")"
        Application.Calculate
        .Value = .Value
    End With
    
    ''Add 2nd Team Stack Pos
    Cells(1, lLastHTeamCol + 6).Value = ChrW(931) & " Stack2 POS"
    With Range(Cells(2, lLastHTeamCol + 6), Cells(lLastRowDeDuped, lLastHTeamCol + 6))
    
    .Formula2R1C1 = "=TEXTJOIN("","",1,IF(RC[-12]:RC[-4]=RC[-1],R1C[-12]:R1C[-4],""""))"
        Application.Calculate
        .Value = .Value
    End With
    
    'Filter 0-1
    Cells(1, lLastHTeamCol + 7).Value = ChrW(931) & " Filter"
    With Range(Cells(2, lLastHTeamCol + 7), Cells(lLastRowDeDuped, lLastHTeamCol + 7))
    
    End With
    
    'Player 1 Filter
    Cells(1, lLastHTeamCol + 8).Value = ChrW(931) & " Player1"
    With Range(Cells(2, lLastHTeamCol + 8), Cells(lLastRowDeDuped, lLastHTeamCol + 8))
    
    End With
    
    'Player 2 Filter
    Cells(1, lLastHTeamCol + 9).Value = ChrW(931) & " Player2"
    With Range(Cells(2, lLastHTeamCol + 9), Cells(lLastRowDeDuped, lLastHTeamCol + 9))
    
    End With
   
    
    'Remove Salary Columns
    Range(Cells(2, lFirstHSortColumn), Cells(lLastRowDeDuped, lLastHTeamCol)).EntireColumn.Delete

    
    
    sOutput = lLastIteration & vbTab & " possible combinations" & vbLf & _
        lLastRow - 1 & vbTab & " unique name combinations" & vbLf & _
        IIf(lLastRowDeDuped <> lLastRow, lLastRow - lLastRowDeDuped & vbTab & " duplicate rows removed." & vbLf, "") & _
        lLastRowDeDuped - 1 & vbTab & " printed." & vbLf & vbLf & _
        Format(Now() - dteStart, "hh:mm:ss") & " to process."
    
    ActiveSheet.UsedRange.Columns.AutoFit
    MsgBox sOutput, , "Output Report"
    Debug.Print sOutput
        
End_Sub:
    Call OptimizeCode_End
    Application.StatusBar = False
    
End Sub
 
You still haven't provided relevant data to post #3.

I don't see any data regarding 60000 for column AV for example.

You need to supply sample data for the before & the data that you expect after the code in post #3 has ran.

Have a look here
The problem is the macro does it all behind the scenes. There is 27 helper columns. The salary of all the players is added and the total is summed in column AV. once the macro is finished. All the helper columns are deleted leaving me what is left in the pictures I posted. As for what I expect to happen after the code I ran is what picture 3 shows. Only I need the data in picture 1 to still be in columns A:I
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Before macro:

Combinations54.xlsm
ABCDEFGHIJKLMNOPQRS
1QBRBRB2WR1WR2WR3TEFLEXDST
2Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceJosh JacobsArizona Cardinals
3Travis Etienne Jr.Aaron JonesDavante AdamsChris OlaveAllen LazardZach ErtzDameon Pierce
4Dalvin CookTony PollardJaylen WaddleAmon-Ra St. BrownGabe DavisT.J. HockensonTravis Etienne Jr.
5Jonathan TaylorDameon PierceAmari CooperCeeDee LambChristian KirkMike GesickiTony Pollard
6Cole KmetJonathan Taylor
7Dalvin Cook
8Aaron Jones
9Jamaal Williams
10Devin Singletary
11James Conner
12Amon-Ra St. Brown
13Jaylen Waddle
14CeeDee Lamb
15JuJu Smith-Schuster
16Amari Cooper
17DeAndre Hopkins
18Allen Lazard
19Christian Kirk
20Chris Olave
21Michael Pittman Jr.
Worksheet


What I expect:

Combinations54.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABAC
1QBRBRB2WR1WR2WR3TEFLEXDSTQBRBRB2WR1WR2WR3TEFLEXDSTComboIDΣ SalaryΣ ProjectionΣ StackΣ Stack POSΣ Stack2Σ Stack2 POSΣ FilterΣ Player1Σ Player2
2Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceJosh JacobsArizona CardinalsPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceDameon PierceArizona Cardinals260000136.66KCQB,WR3,TEARIWR2,DST
3Travis Etienne Jr.Aaron JonesDavante AdamsChris OlaveAllen LazardZach ErtzDameon PiercePatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceTravis Etienne Jr.Arizona Cardinals359800140.09KCQB,WR3,TEARIWR2,DST
4Dalvin CookTony PollardJaylen WaddleAmon-Ra St. BrownGabe DavisT.J. HockensonTravis Etienne Jr.Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceTony PollardArizona Cardinals460000136.15KCQB,WR3,TEARIWR2,DST
5Jonathan TaylorDameon PierceAmari CooperCeeDee LambChristian KirkMike GesickiTony PollardPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceDalvin CookArizona Cardinals659600138.32KCQB,WR3,TEMINWR1,FLEX
6Cole KmetJonathan TaylorPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceAaron JonesArizona Cardinals759800137.31KCQB,WR3,TEARIWR2,DST
7Dalvin CookPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceJamaal WilliamsArizona Cardinals859900132.09KCQB,WR3,TEARIWR2,DST
8Aaron JonesPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceDevin SingletaryArizona Cardinals960000131.51KCQB,WR3,TEARIWR2,DST
9Jamaal WilliamsPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceJames ConnerArizona Cardinals1059800132.59KCQB,WR3,TEARIWR2,FLEX,DST
10Devin SingletaryPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceAmon-Ra St. BrownArizona Cardinals1160000135.04KCQB,WR3,TEARIWR2,DST
11James ConnerPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceJaylen WaddleArizona Cardinals1260000138.31KCQB,WR3,TEARIWR2,DST
12Amon-Ra St. BrownPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceCeeDee LambArizona Cardinals1359900134.93KCQB,WR3,TEARIWR2,DST
13Jaylen WaddlePatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceAmari CooperArizona Cardinals1559600135.94KCQB,WR3,TECLEFLEX
14CeeDee LambPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceAllen LazardArizona Cardinals1759800134.42KCQB,WR3,TEARIWR2,DST
15JuJu Smith-SchusterPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceChristian KirkArizona Cardinals1859400133.9KCQB,WR3,TEARIWR2,DST
16Amari CooperPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzDameon PierceArizona Cardinals2259600128.68ARIWR2,TE,DSTKCWR3
17DeAndre HopkinsPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzTravis Etienne Jr.Arizona Cardinals2359700132.11ARIWR2,TE,DSTKCWR3
18Allen LazardPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzTony PollardArizona Cardinals2459900128.17ARIWR2,TE,DSTKCWR3
19Christian KirkPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzDalvin CookArizona Cardinals2659900130.34ARIWR2,TE,DSTKCWR3
20Chris OlavePatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzAaron JonesArizona Cardinals2760000129.33ARIWR2,TE,DSTKCWR3
21Michael Pittman Jr.Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzJamaal WilliamsArizona Cardinals2859800124.11ARIWR2,TE,DSTKCWR3
22Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzDevin SingletaryArizona Cardinals2960000123.53ARIWR2,TE,DSTKCWR3
23Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzJames ConnerArizona Cardinals3060000124.61ARIWR2,TE,FLEX,DSTKCWR3
Worksheet


What it looks like after macro runs and without deleting helper columns during macro. (I have the filter set to row 21 in the macro, therefore its giving me almost desired results as it isn't removing my names in columns A:I, however in the salary column, there are still combinations showing over 60000k for the first 21 rows for this reason.

Combinations54.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABBBCBD
1QBRBRB2WR1WR2WR3TEFLEXDSTQBRBRB2WR1WR2WR3TEFLEXDSTComboIDQBRBRB2WR1WR2WR3TEFLEXDSTQBRBRB2WR1WR2WR3TEFLEXDSTQBRBRB2WR1WR2WR3TEFLEXDSTΣ SalaryΣ ProjectionΣ StackΣ Stack POSΣ Stack2Σ Stack2 POSΣ FilterΣ Player1Σ Player2
2Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceJosh JacobsArizona CardinalsPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceDameon PierceArizona Cardinals240007000770083008400850085008600900023.7117.7714.4617.8412.7811.7718.2913.576.47KCCLELVMINARIKCKCHOUARI70000136.66KCQB,WR3,TEARIWR2,DST
3Travis Etienne Jr.Aaron JonesDavante AdamsChris OlaveAllen LazardZach ErtzDameon PiercePatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceTravis Etienne Jr.Arizona Cardinals340007000800083008400850085008600900023.7117.7714.4617.8412.7811.7718.29176.47KCCLELVMINARIKCKCJACARI70300140.09KCQB,WR3,TEARIWR2,DST
4Dalvin CookTony PollardJaylen WaddleAmon-Ra St. BrownGabe DavisT.J. HockensonTravis Etienne Jr.Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceTony PollardArizona Cardinals440007000700083008400850085008600900023.7117.7714.4617.8412.7811.7718.2913.066.47KCCLELVMINARIKCKCDALARI69300136.15KCQB,WR3,TEARIWR2,DST
5Jonathan TaylorDameon PierceAmari CooperCeeDee LambChristian KirkMike GesickiTony PollardPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceDalvin CookArizona Cardinals640007000750083008400850085008600900023.7117.7714.4617.8412.7811.7718.2915.236.47KCCLELVMINARIKCKCMINARI69800138.32KCQB,WR3,TEMINWR1,FLEX
6Cole KmetJonathan TaylorPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceAaron JonesArizona Cardinals740007000720083008400850085008600900023.7117.7714.4617.8412.7811.7718.2914.226.47KCCLELVMINARIKCKCGBARI69500137.31KCQB,WR3,TEARIWR2,DST
7Dalvin CookPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceJamaal WilliamsArizona Cardinals840007000740083008400850085008600900023.7117.7714.4617.8412.7811.7718.2996.47KCCLELVMINARIKCKCDETARI69700132.09KCQB,WR3,TEARIWR2,DST
8Aaron JonesPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceDevin SingletaryArizona Cardinals940005600700083008400850085008600900023.7117.7714.4617.8412.7811.7718.298.426.47KCCLELVMINARIKCKCBUFARI67900131.51KCQB,WR3,TEARIWR2,DST
9Jamaal WilliamsPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceJames ConnerArizona Cardinals1040006300700083008400850085008600900023.7117.7714.4617.8412.7811.7718.299.56.47KCCLELVMINARIKCKCARIARI68600132.59KCQB,WR3,TEARIWR2,FLEX,DST
10Devin SingletaryPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceAmon-Ra St. BrownArizona Cardinals1140006900700083008400850085008600900023.7117.7714.4617.8412.7811.7718.2911.956.47KCCLELVMINARIKCKCDETARI69200135.04KCQB,WR3,TEARIWR2,DST
11James ConnerPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceJaylen WaddleArizona Cardinals1240007000820083008400850085008600900023.7117.7714.4617.8412.7811.7718.2915.226.47KCCLELVMINARIKCKCMIAARI70500138.31KCQB,WR3,TEARIWR2,DST
12Amon-Ra St. BrownPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceCeeDee LambArizona Cardinals1340007000760083008400850085008600900023.7117.7714.4617.8412.7811.7718.2911.846.47KCCLELVMINARIKCKCDALARI69900134.93KCQB,WR3,TEARIWR2,DST
13Jaylen WaddlePatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceAmari CooperArizona Cardinals1540007000780083008400850085008600900023.7117.7714.4617.8412.7811.7718.2912.856.47KCCLELVMINARIKCKCCLEARI70100135.94KCQB,WR3,TECLEFLEX
14CeeDee LambPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceAllen LazardArizona Cardinals1740006700700083008400850085008600900023.7117.7714.4617.8412.7811.7718.2911.336.47KCCLELVMINARIKCKCGBARI69000134.42KCQB,WR3,TEARIWR2,DST
15JuJu Smith-SchusterPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceChristian KirkArizona Cardinals1840006800700083008400850085008600900023.7117.7714.4617.8412.7811.7718.2910.816.47KCCLELVMINARIKCKCJACARI69100133.9KCQB,WR3,TEARIWR2,DST
16Amari CooperPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzDameon PierceArizona Cardinals2240006300700077008300840085008600900023.7117.7714.4617.8412.7811.7710.3113.576.47KCCLELVMINARIKCARIHOUARI67800128.68ARIWR2,TE,DSTKCWR3
17DeAndre HopkinsPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzTravis Etienne Jr.Arizona Cardinals2340006300700080008300840085008600900023.7117.7714.4617.8412.7811.7710.31176.47KCCLELVMINARIKCARIJACARI68100132.11ARIWR2,TE,DSTKCWR3
18Allen LazardPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzTony PollardArizona Cardinals2440006300700070008300840085008600900023.7117.7714.4617.8412.7811.7710.3113.066.47KCCLELVMINARIKCARIDALARI67100128.17ARIWR2,TE,DSTKCWR3
19Christian KirkPatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzDalvin CookArizona Cardinals2640006300700075008300840085008600900023.7117.7714.4617.8412.7811.7710.3115.236.47KCCLELVMINARIKCARIMINARI67600130.34ARIWR2,TE,DSTKCWR3
20Chris OlavePatrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzAaron JonesArizona Cardinals2740006300700072008300840085008600900023.7117.7714.4617.8412.7811.7710.3114.226.47KCCLELVMINARIKCARIGBARI67300129.33ARIWR2,TE,DSTKCWR3
21Michael Pittman Jr.Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzJamaal WilliamsArizona Cardinals2840006300700074008300840085008600900023.7117.7714.4617.8412.7811.7710.3196.47KCCLELVMINARIKCARIDETARI67500124.11ARIWR2,TE,DSTKCWR3
22Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterZach ErtzDevin SingletaryArizona Cardinals2940005600630070008300840085008600900023.7117.7714.4617.8412.7811.7710.318.426.47KCCLELVMINARIKCARIBUFARI65700123.53ARIWR2,TE,DSTKCWR3
Worksheet
 
Last edited:
Upvote 0
Sorry, that still doesn't help me in regards to post #3.
 
Upvote 0
Sorry, that still doesn't help me in regards to post #3.
I'm sorry for not being clear, I don't know what more information you need.

The code posted in post #3 job, or atleast what I want it to do is filter out the range K:BD BASED ON the value in AV. IF the value in AV is greater than 60,000 in that row, then delete then delete the cells between K:BD.

lFirstWriteColumn is column K in my last post and column BD is lLastHTeamCol+9.

I'm basically trying to delete half rows so I don't lose data in A:I.

Once the ranges in K:BD are deleted that are over 60,000, I want it to unfiltered to show all that is 60,000 or under.

The code I posted in 3 does what I am wanting...but for some reason and isn't just deleting the data in IN K:BD, I'm losing what is in A:I.
 
Upvote 0
I ended up taking a different approach, and decided to cut and paste the data from A:I to another sheet before filtering, then re-pasting the data after the filter. I appreciate you trying to assist. Sorry for any confusion.
 
Upvote 0
I see the problem now, it was a line from your original code that you said worked.

VBA Code:
    lngLastRow = Cells(Rows.Count, lLastHTeamCol + 1).End(xlUp).Row

In your last XL2BB post, that results to lngLastRow = 1

You would be better off using:
VBA Code:
    lngLastRow = Cells.Find("*", , xlFormulas, , xlByRows, xlPrevious).Row

That would make lngLastRow = 22

So the code to answer post # 3 could be:
VBA Code:
    Dim lFirstWriteColumn   As Long
    Dim lLastColumn         As Long
    Dim lngLastRow          As Long
    Dim x                   As Long
    Dim lLastHTeamCol       As Long
    Dim RangesToDelete      As Range
'
    lLastColumn = Range("A1").CurrentRegion.Columns.Count
'
    lFirstWriteColumn = lLastColumn + 2
'
    lLastHTeamCol = Cells(1, Columns.Count).End(xlToLeft).Column
'
    lngLastRow = Cells.Find("*", , xlFormulas, , xlByRows, xlPrevious).Row
'
    x = 60000
'
    With ActiveSheet
        With .Columns("AV:AV")
            .AutoFilter Field:=1, Criteria1:=">" & x
'
            On Error Resume Next
                Set RangesToDelete = Range(Cells(2, lFirstWriteColumn), Cells(lngLastRow, lLastHTeamCol + 9)).SpecialCells(xlCellTypeVisible)
            On Error GoTo 0
'
            .AutoFilter
'
            If Not RangesToDelete Is Nothing Then
                RangesToDelete.Delete Shift:=xlShiftUp
            End If
'
        End With
    End With
 
Upvote 0
Solution
I see the problem now, it was a line from your original code that you said worked.

VBA Code:
    lngLastRow = Cells(Rows.Count, lLastHTeamCol + 1).End(xlUp).Row

In your last XL2BB post, that results to lngLastRow = 1

You would be better off using:
VBA Code:
    lngLastRow = Cells.Find("*", , xlFormulas, , xlByRows, xlPrevious).Row

That would make lngLastRow = 22

So the code to answer post # 3 could be:
VBA Code:
    Dim lFirstWriteColumn   As Long
    Dim lLastColumn         As Long
    Dim lngLastRow          As Long
    Dim x                   As Long
    Dim lLastHTeamCol       As Long
    Dim RangesToDelete      As Range
'
    lLastColumn = Range("A1").CurrentRegion.Columns.Count
'
    lFirstWriteColumn = lLastColumn + 2
'
    lLastHTeamCol = Cells(1, Columns.Count).End(xlToLeft).Column
'
    lngLastRow = Cells.Find("*", , xlFormulas, , xlByRows, xlPrevious).Row
'
    x = 60000
'
    With ActiveSheet
        With .Columns("AV:AV")
            .AutoFilter Field:=1, Criteria1:=">" & x
'
            On Error Resume Next
                Set RangesToDelete = Range(Cells(2, lFirstWriteColumn), Cells(lngLastRow, lLastHTeamCol + 9)).SpecialCells(xlCellTypeVisible)
            On Error GoTo 0
'
            .AutoFilter
'
            If Not RangesToDelete Is Nothing Then
                RangesToDelete.Delete Shift:=xlShiftUp
            End If
'
        End With
    End With
[/C
[/QUOTE]
Thanks for your response. It now loads everything and looks like it worked but it removes the Salary header and all the salaries. I double checked what they would have been and they were all 60k or under. Not sure why it removes the header and salaries though.
 
Last edited:
Upvote 0
Can you post via XL2BB the data that you are starting with before you run the code I most recently posted and the result after the code is ran?

I ask because the code worked fine for me.
 
Upvote 0
Can you post via XL2BB the data that you are starting with before you run the code I most recently posted and the result after the code is ran?

I ask because the code worked fine for me.
Combinations56.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAV
1QBRBRB2WR1WR2WR3TEFLEXDST
2Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceJosh JacobsDenver Broncos
3Travis Etienne Jr.Aaron JonesDavante AdamsChris OlaveAllen LazardZach ErtzDameon PierceTennessee Titans
4Dalvin CookTony PollardJaylen WaddleAmon-Ra St. BrownGabe DavisT.J. HockensonTravis Etienne Jr.
5Jonathan TaylorDameon PierceAmari CooperCeeDee LambChristian KirkMike GesickiTony Pollard
6Cole KmetJonathan Taylor
7Dalvin Cook
8Aaron Jones
9Jamaal Williams
10Christian Kirk
11Chris Olave
12Michael Pittman Jr.
13
14
Worksheet


after:
Combinations56.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABAC
1QBRBRB2WR1WR2WR3TEFLEXDSTQBRBRB2WR1WR2WR3TEFLEXDSTComboIDΣ ProjectionΣ StackΣ Stack POSΣ Stack2Σ Stack2 POSΣ FilterΣ Player1Σ Player2
2Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceJosh JacobsDenver BroncosPatrick MahomesDalvin CookTony PollardAmari CooperAmon-Ra St. BrownGabe DavisMike GesickiMichael Pittman Jr.Tennessee Titans76868110.75#N/A#N/A0
3Travis Etienne Jr.Aaron JonesDavante AdamsChris OlaveAllen LazardZach ErtzDameon PierceTennessee TitansPatrick MahomesJonathan TaylorAaron JonesAmari CooperAmon-Ra St. BrownAllen LazardMike GesickiMichael Pittman Jr.Tennessee Titans97878111.79INDRB,FLEXGBWR3
4Dalvin CookTony PollardJaylen WaddleAmon-Ra St. BrownGabe DavisT.J. HockensonTravis Etienne Jr.Patrick MahomesJonathan TaylorAaron JonesAmari CooperAmon-Ra St. BrownGabe DavisMike GesickiMichael Pittman Jr.Denver Broncos97987112.41INDRB,FLEX0
5Jonathan TaylorDameon PierceAmari CooperCeeDee LambChristian KirkMike GesickiTony PollardPatrick MahomesJonathan TaylorAaron JonesAmari CooperAmon-Ra St. BrownGabe DavisMike GesickiMichael Pittman Jr.Tennessee Titans97988111.66INDRB,FLEX0
6Cole KmetJonathan TaylorPatrick MahomesJonathan TaylorAaron JonesAmari CooperAmon-Ra St. BrownGabe DavisCole KmetMichael Pittman Jr.Tennessee Titans98010111.14INDRB,FLEX0
7Dalvin CookPatrick MahomesJonathan TaylorAaron JonesAmari CooperAmon-Ra St. BrownChristian KirkMike GesickiMichael Pittman Jr.Tennessee Titans98098111.27INDRB,FLEX0
8Aaron JonesPatrick MahomesJonathan TaylorTony PollardJaylen WaddleAmon-Ra St. BrownGabe DavisMike GesickiMichael Pittman Jr.Tennessee Titans103268112.87INDRB,FLEXMIAWR1,TE
9Jamaal WilliamsPatrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownJuju Smith-SchusterMike GesickiMichael Pittman Jr.Tennessee Titans104808111.07KCWR30
10Christian KirkPatrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownAllen LazardMike GesickiMichael Pittman Jr.Denver Broncos104917111.38INDRB,FLEX0
11Chris OlavePatrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownAllen LazardMike GesickiMichael Pittman Jr.Tennessee Titans104918110.63INDRB,FLEX0
12Michael Pittman Jr.Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownAllen LazardCole KmetMichael Pittman Jr.Tennessee Titans104940110.11INDRB,FLEX0
13Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownGabe DavisMike GesickiChristian KirkTennessee Titans105024111.13#N/A#N/A0
14Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownGabe DavisMike GesickiMichael Pittman Jr.Denver Broncos105027111.25INDRB,FLEX0
15Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownGabe DavisMike GesickiMichael Pittman Jr.Tennessee Titans105028110.5INDRB,FLEX0
16Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownGabe DavisCole KmetMichael Pittman Jr.Denver Broncos105049110.73INDRB,FLEX0
17Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownGabe DavisCole KmetMichael Pittman Jr.Tennessee Titans105050109.98INDRB,FLEX0
18Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownChristian KirkMike GesickiMichael Pittman Jr.Tennessee Titans105138110.11INDRB,FLEX0
19Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownChristian KirkCole KmetMichael Pittman Jr.Tennessee Titans105160109.59INDRB,FLEX0
20
Worksheet


after but with helper columns showing:
Combinations56.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABBBCBDBE
1QBRBRB2WR1WR2WR3TEFLEXDSTQBRBRB2WR1WR2WR3TEFLEXDSTComboIDQBRBRB2WR1WR2WR3TEFLEXDSTQBRBRB2WR1WR2WR3TEFLEXDSTQBRBRB2WR1WR2WR3TEFLEXDSTΣ SalaryΣ ProjectionΣ StackΣ Stack POSΣ Stack2Σ Stack2 POSΣ FilterΣ Player1Σ Player2
2Patrick MahomesNick ChubbJosh JacobsJustin JeffersonDeAndre HopkinsJuju Smith-SchusterTravis KelceJosh JacobsDenver BroncosPatrick MahomesDalvin CookTony PollardAmari CooperAmon-Ra St. BrownGabe DavisMike GesickiMichael Pittman Jr.Tennessee Titans7686844005100630065006900700075007800850023.7115.2313.0612.8511.9511.26.3110.186.26KCMINDALCLEDETBUFMIAINDTEN60000110.75#N/A#N/A0
3Travis Etienne Jr.Aaron JonesDavante AdamsChris OlaveAllen LazardZach ErtzDameon PierceTennessee TitansPatrick MahomesJonathan TaylorAaron JonesAmari CooperAmon-Ra St. BrownAllen LazardMike GesickiMichael Pittman Jr.Tennessee Titans9787844005100630067006900700072007800850023.7114.9814.2212.8511.9511.336.3110.186.26KCINDGBCLEDETGBMIAINDTEN59900111.79INDRB,FLEXGBWR3
4Dalvin CookTony PollardJaylen WaddleAmon-Ra St. BrownGabe DavisT.J. HockensonTravis Etienne Jr.Patrick MahomesJonathan TaylorAaron JonesAmari CooperAmon-Ra St. BrownGabe DavisMike GesickiMichael Pittman Jr.Denver Broncos9798747005100630065006900700072007800850023.7114.9814.2212.8511.9511.26.3110.187.01KCINDGBCLEDETBUFMIAINDDEN60000112.41INDRB,FLEX0
5Jonathan TaylorDameon PierceAmari CooperCeeDee LambChristian KirkMike GesickiTony PollardPatrick MahomesJonathan TaylorAaron JonesAmari CooperAmon-Ra St. BrownGabe DavisMike GesickiMichael Pittman Jr.Tennessee Titans9798844005100630065006900700072007800850023.7114.9814.2212.8511.9511.26.3110.186.26KCINDGBCLEDETBUFMIAINDTEN59700111.66INDRB,FLEX0
6Cole KmetJonathan TaylorPatrick MahomesJonathan TaylorAaron JonesAmari CooperAmon-Ra St. BrownGabe DavisCole KmetMichael Pittman Jr.Tennessee Titans9801044005300630065006900700072007800850023.7114.9814.2212.8511.9511.25.7910.186.26KCINDGBCLEDETBUFCHIINDTEN59900111.14INDRB,FLEX0
7Dalvin CookPatrick MahomesJonathan TaylorAaron JonesAmari CooperAmon-Ra St. BrownChristian KirkMike GesickiMichael Pittman Jr.Tennessee Titans9809844005100630068006900700072007800850023.7114.9814.2212.8511.9510.816.3110.186.26KCINDGBCLEDETJACMIAINDTEN60000111.27INDRB,FLEX0
8Aaron JonesPatrick MahomesJonathan TaylorTony PollardJaylen WaddleAmon-Ra St. BrownGabe DavisMike GesickiMichael Pittman Jr.Tennessee Titans10326844005100630065006900700070008200850023.7114.9813.0615.2211.9511.26.3110.186.26KCINDDALMIADETBUFMIAINDTEN59900112.87INDRB,FLEXMIAWR1,TE
9Jamaal WilliamsPatrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownJuju Smith-SchusterMike GesickiMichael Pittman Jr.Tennessee Titans10480844005100630069007000700070007800850023.7114.9813.0612.8511.9511.776.3110.186.26KCINDDALCLEDETKCMIAINDTEN60000111.07KCWR30
10Christian KirkPatrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownAllen LazardMike GesickiMichael Pittman Jr.Denver Broncos10491747005100630067006900700070007800850023.7114.9813.0612.8511.9511.336.3110.187.01KCINDDALCLEDETGBMIAINDDEN60000111.38INDRB,FLEX0
11Chris OlavePatrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownAllen LazardMike GesickiMichael Pittman Jr.Tennessee Titans10491844005100630067006900700070007800850023.7114.9813.0612.8511.9511.336.3110.186.26KCINDDALCLEDETGBMIAINDTEN59700110.63INDRB,FLEX0
12Michael Pittman Jr.Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownAllen LazardCole KmetMichael Pittman Jr.Tennessee Titans10494044005300630067006900700070007800850023.7114.9813.0612.8511.9511.335.7910.186.26KCINDDALCLEDETGBCHIINDTEN59900110.11INDRB,FLEX0
13Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownGabe DavisMike GesickiChristian KirkTennessee Titans10502444005100650068006900700070007800850023.7114.9813.0612.8511.9511.26.3110.816.26KCINDDALCLEDETBUFMIAJACTEN60000111.13#N/A#N/A0
14Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownGabe DavisMike GesickiMichael Pittman Jr.Denver Broncos10502747005100630065006900700070007800850023.7114.9813.0612.8511.9511.26.3110.187.01KCINDDALCLEDETBUFMIAINDDEN59800111.25INDRB,FLEX0
15Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownGabe DavisMike GesickiMichael Pittman Jr.Tennessee Titans10502844005100630065006900700070007800850023.7114.9813.0612.8511.9511.26.3110.186.26KCINDDALCLEDETBUFMIAINDTEN59500110.5INDRB,FLEX0
16Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownGabe DavisCole KmetMichael Pittman Jr.Denver Broncos10504947005300630065006900700070007800850023.7114.9813.0612.8511.9511.25.7910.187.01KCINDDALCLEDETBUFCHIINDDEN60000110.73INDRB,FLEX0
17Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownGabe DavisCole KmetMichael Pittman Jr.Tennessee Titans10505044005300630065006900700070007800850023.7114.9813.0612.8511.9511.25.7910.186.26KCINDDALCLEDETBUFCHIINDTEN59700109.98INDRB,FLEX0
18Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownChristian KirkMike GesickiMichael Pittman Jr.Tennessee Titans10513844005100630068006900700070007800850023.7114.9813.0612.8511.9510.816.3110.186.26KCINDDALCLEDETJACMIAINDTEN59800110.11INDRB,FLEX0
19Patrick MahomesJonathan TaylorTony PollardAmari CooperAmon-Ra St. BrownChristian KirkCole KmetMichael Pittman Jr.Tennessee Titans10516044005300630068006900700070007800850023.7114.9813.0612.8511.9510.815.7910.186.26KCINDDALCLEDETJACCHIINDTEN60000109.59INDRB,FLEX0
Worksheet


So whats really happening now is that everything from the the salary row onward is shifting 1 column over, leaving a blank column. Then when the macro deletes all the helper columns, it must be just leaving the blank column. I'm sure it has nothing to do with your code and has to do with how I assigned the columns. I am thinking I may just need to keep the copy/paste solution i'm currently using, but I do appreciate your help and will mark yours as solution.
 
Upvote 0

Forum statistics

Threads
1,224,812
Messages
6,181,104
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top