Consolidating non-blank rows from a 2d range

daabs

New Member
Joined
Feb 25, 2007
Messages
3
I have a 2d range which has some blank rows in it. I would like to be able to take the non-blank rows and consolidate them as a contiguous block in another range without disturbing the original table.

Any ideas, anyone?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
you can try this. there's no copy to column procedure (since you didn't mention where it was to be copied). so, you can copy the data to the column of your choosing the run the below macro. note: the below macro uses defaults (ie. Sheet1, Column A) so you'll have to change those to the sheet you want and the column letter you want.

Code:
Sub DeleteBlanks()

Dim LR As Long, i As Long

LR = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row

For i = LR To 1 Step -1
    If Range("A" & i) = "" Then
       Range("A" & i).Delete Shift:=xlUp
    End If
Next

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

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