Below I have two subs, once RearrangeDecks is run, it will call moveToEnd(p1stat,p2stat). I get p1stat and p2stat from a different sub used earlier. However when I run it, it gives me back an error saying "Arguments not optional" as well ass highlighting the first offset word in the sub "MoveToEnd."
In in essence, I have 2 lists of cards. What im trying to code is if P1stat is bigger, then I want the top card of the first stack (Range D3 from D3:D18) to be brought to the bottom of the stack and then the top card of the second stack to be brought to the bottom of the first (so , if p1Stat is bigger, then I want F3 to go from F3:F18 to the bottom of D3:D18) If p2Stat is bigger, then I want the top of F3:F18 to go to the bottom as well as the top card or B3 to go to the bottom of the range of F3:F18.
Public Sub RearrangeDecks()
'Call MoveToEnd(currentWinner)
MoveToEnd p1Stat, p2Stat
Call ShiftUp
Worksheets("Battle").Activate
End Sub
Sub MoveToEnd(ByVal p1Stat As Integer, ByVal p2Stat As Integer)
Worksheets("Card Assignments").Activate
Dim count As Integer
If p1Stat > p2Stat Then
Range("D3").Activate
For count = 0 To 15
If ActiveCell.Offset(count, 0) = "" And ActiveCell.Offset(count - 1, 0) <> "" Then ActiveCell.Offset(count, 0) = FindWinner
Next count
For count = 0 To 15
If ActiveCell.Offset(count, 0) = "" And ActiveCell.Offset(count - 1, 0) <> "" Then ActiveCell.Offset(count, 0) = Range("F3").Value
Next count
ElseIf p2Stat > p1Stat Then
Range("F3").Activate
For count = 0 To 15
If ActiveCell.Offset(count, 0) = "" And ActiveCell.Offset(count - 1, 0) <> "" Then ActiveCell.Offset(count, 0) = FindWinner
Next count
For count = 0 To 15
If ActiveCell.Offset(count, 0) = "" And ActiveCell.Offset(count - 1, 0) <> "" Then ActiveCell.Offset(count, 0) = Range("D3").Value
Next count
ElseIf p1Stat = p2Stat Then
Range("D3").Activate
For count = 0 To 15
If ActiveCell.Offset(count, 0) = "" And ActiveCell.Offset(count - 1, 0) <> "" Then ActiveCell.Offset(count, 0) = Range("D3").Value
Next count
Range("F3").Activate
For count = 0 To 15
If ActiveCell.Offset(count, 0) = "" And ActiveCell.Offset(count - 1, 0) <> "" Then ActiveCell.Offset(count, 0) = Range("F3").Value
Next count
End If
End Sub
Any suggestions?