Having trouble unnesting a function that has multiple variables within the loop that needs to change. I have data that is housed into a a few rows but an annoying amount of columns. I am taking the data and stacking it on top of each other so it can be manipulated more. I need a way to change both variables y
& n
on the same next
otherwise it gets stuck into an infinite loop and crashes.
I want the y
's to continue on a normal step but need the n
's to change with them, otherwise the data is just overwriting and it's repeating itself.
Sub pasteanswers()
Dim LastCol As Integer
Dim y As Integer
Dim x As Integer
Dim n As Integer
Dim v As Integer
With ActiveSheet
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column - 7
r2s = (LastCol / 2)
End With
For x = 6 To 28
For n = 1 To r2s
For y = 6 To 1721
Cells(y, 8).Value = Cells(x, ((2 * n + 8))).Value
Cells(y, 9).Value = Cells(x, ((2 * n) + 9)).Value
Next y
Next n
Next x
End Sub