I am reasking this post as likely the information wasnt clear on the first post.
I am trying to use a sort I copied from the forum posts but I am unable to create the Else condition correctly.
The spreadsheet is attached, I am trying to copy data from the "InstData" sheet to the "RawData" sheet and have it transfer in the "goal" order. The condition or the loop is constructed incorrectly. The negative condition should transfer the remainder of the rows which are not in the positive condition.
Thank you Ron
module 2
Sub aaCopytoRawData()
Application.ScreenUpdating = False
Sheets("InstData").Activate
Dim lastrow, lastcolumn As Integer
lastrow = Cells(Rows.Count, 4).End(xlUp).Row
lastcolumn = ActiveSheet.Range("a1").End(xlToRight).Column
Dim X, Y, P, Z As Integer
With Worksheets("InstData")
For P = 1 To 13
For Z = 1 To lastrow
For X = 1 To lastrow
For Y = 1 To lastcolumn
If Worksheets("InstData").Cells(X, 1) = Worksheets("Config").Cells(P + 6, 8) Then
Worksheets("RawData").Cells(P, Y) = .Cells(X, Y)
'Else: Worksheets("RawData").Cells(Z, Y) = .Cells(X, Y)
End If
Next Y
Next X
Next Z
Next P
End With
Sheets("RawData").Activate
Range("b2").Select
End Sub
Bookmarks