additional infor.. i broke it down to the rudimentary code, and still only two of the 4 work...
the virgin and the rewash do not work.
Hello, first off let me apologize in advance for my lower than novice style of coding.
What i'm trying to do is sort 2 columns containing 4 types of data break it down in to 4 separate sections on a different sheet (8 columns in all)
I separated the if statements and only the 3rd and 4th ifs ever get put to use. I triple checked to make sure that the cells(x,y) = "value" for my logical condition was correctly entered. Any help would be very much appreciated.
Code:
Sub craptest()
LastRow = Range("A65536").End(xlUp).Row
For k = 1 To LastRow Step 1
If Cells(k, 19) = "Rewash" Then
Cells(k, 26) = Cells(k, 19)
Else
If Cells(k, 19) = "Virgin" Then
Cells(k, 26) = Cells(k, 19)
Else
If Cells(k, 19) = "Rewash outlier" Then
Cells(k, 26) = Cells(k, 19)
Else
If Cells(k, 19) = "Virgin outlier" Then
Cells(k, 26) = Cells(k, 19)
End If
End If
End If
End If
Next k
End Sub
the virgin and the rewash do not work.
Hello, first off let me apologize in advance for my lower than novice style of coding.
What i'm trying to do is sort 2 columns containing 4 types of data break it down in to 4 separate sections on a different sheet (8 columns in all)
I separated the if statements and only the 3rd and 4th ifs ever get put to use. I triple checked to make sure that the cells(x,y) = "value" for my logical condition was correctly entered. Any help would be very much appreciated.
Code:
Sub transferpot()
LastRow = Range("A65536").End(xlUp).Row
Dim counter As Integer
Dim counter1 As Integer
Dim counter2 As Integer
Dim counter3 As Integer
counter = 1
counter1 = 1
counter2 = 1
counter3 = 1
Dim k As Integer
For k = 2 To LastRow Step 1
If Cells(k, 19) = "Rewash" Then
Sheets("sheet4").Cells(counter2, 5) = Sheets("Sheet1").Cells(k, 11)
Sheets("sheet4").Cells(counter2, 6) = Sheets("Sheet1").Cells(k, 12)
counter2 = counter2 + 1
Else
If Cells(k, 19) = "Virgin" Then
Sheets("sheet4").Cells(counter3, 7) = Sheets("Sheet1").Cells(k, 11)
Sheets("sheet4").Cells(counter3, 8) = Sheets("Sheet1").Cells(k, 12)
counter = counter + 1
Else
If Cells(k, 19) = "Rewash outlier" Then
Sheets("sheet4").Cells(counter3, 7) = Sheets("Sheet1").Cells(k, 11)
Sheets("sheet4").Cells(counter3, 8) = Sheets("Sheet1").Cells(k, 12)
counter3 = counter3 + 1
Else
If Cells(k, 19) = "Virgin outlier" Then
Sheets("sheet4").Cells(counter1, 3) = Sheets("Sheet1").Cells(k, 11)
Sheets("sheet4").Cells(counter1, 4) = Sheets("Sheet1").Cells(k, 12)
counter1 = counter1 + 1
End If
End If
End If
End If
Next k
End Sub
Last edited: