*Sorting Every 2nd Row To Be On A Single Line with outliers within Data Set

Justijb

New Member
Joined
Aug 16, 2016
Messages
43
Hello all,

I may have jumped to conclusion. One final piece of the query. The code provided by JLGWhiz works perfectly fine but I needed to ask my question with even more specificity. And again, thanks for the reply, JLGWhiz.

__CODE__

Sub t()
Dim sh As Worksheet, i As Long
Set sh = ActiveSheet
With sh
For i = 2 To sh.Cells(Rows.Count, 1).End(xlUp).Row Step 2
.Cells(i, 1).Resize(1, 5).Cut .Cells(i - 1, Columns.Count).End(xlToLeft).Offset(, 1)
Next
.Range("A1", .Cells(Rows.Count, 1).End(xlUp)).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub

___END___

But of each data set, every second row, the data in row 1 corresponds with row 2. e.g. A1 & A2 match. So when using the code provided it works perfect *except* for when the row doesn't have a matching set of information in the proceeding row. Explanation: Row 1 through 67, the rows align (data set equals up), then row 68 it doesn't have a proceeding row that matches, then row 69&70 has a data set, then 71 does not.

So my question is in a sheet of 27,018 entries, is their a code to align the data to match by field in row 1 and row 2 throughout the sheet and *also account for the fields in the rows that don't have corresponding data to match.

Best way I can visualize it:

A
A
B
C
C
D
E
E

And make it look like

AA
B
CC
D
EE

Again, not sure if I'm explaining myself correctly so here's to hoping. As always, I can provide more information.

Thanks so much!

R/

J
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,216,136
Messages
6,129,080
Members
449,485
Latest member
greggy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top