My for J loop works well, and the For k works ok for the first iteration then jumps to B19 and doesn't move. I want my program to work for the k loop to work identical to the J loop where it selects the next value before looping. Totalval is a sum containing the amount of rows in the data to create the number of iterations to calculate. Sorry about the message boxes in the code, It helps me to keep track of what everything is
For k = 0 To totalvals Step 1
For j = 0 To totalvals Step 1
'MsgBox "in J for loop"
If j = 0 Then
'MsgBox "in for if J loop"
Range("b3").Select
'MsgBox ActiveCell.Value & " is the cell value"
Else
End If
total = total + ActiveCell.Value
ActiveCell.Offset(1, 0).Select
'MsgBox " after offset, cell value is " & ActiveCell.Value
If j = totalvals Then
'MsgBox "j = total val now"
profit = total * Range("h6")
'MsgBox "Current total profit is " & profit
total = 0
Else
End If
Next j
If k = 0 Then
MsgBox " k = 0 , select cell c3 "
MsgBox "profit from before " & profit & " " & "Starting total: " & total
Range("c3").Select
MsgBox "activecell.value is " & ActiveCell.Value
Else
End If
total = total + ActiveCell.Value
MsgBox " In K Current units sold " & total
ActiveCell.Offset(1, 0).Select
MsgBox " after offset, cell value is " & ActiveCell.Value
MsgBox ActiveCell.Row & ActiveCell.Column
next k
Bookmarks