sharky12345
Well-known Member
- Joined
- Aug 5, 2010
- Messages
- 3,422
- Office Version
- 2016
- Platform
- Windows
I'm using this to sort data into different columns depending on a cell value;
The issue I have is that it it leaving blank rows in the sorted data because the cells housing "N" or "Y" are not contiguous.
I know why it's doing it, just not how to resolve it if anyone can help?
Code:
Sheet9.Range("P2:T40").ClearContents
For Each Cell In Sheet9.Range("E2:E28")
If Cell <> "" Then
If Cell.Offset(0, 3) = "N" Then
Cell.Offset(0, 11).Value = Cell
Cell.Offset(0, 12).Value = Cell.Offset(0, 1).Value
End If
If Cell.Offset(0, 3) = "Y" Then
Cell.Offset(0, 14).Value = Cell
Cell.Offset(0, 15).Value = Cell.Offset(0, 1).Value
End If
End If
Next
The issue I have is that it it leaving blank rows in the sorted data because the cells housing "N" or "Y" are not contiguous.
I know why it's doing it, just not how to resolve it if anyone can help?