Condense Data

lacogada

Board Regular
Joined
Jan 26, 2011
Messages
170
Would like to make a selection then condense the data.

Information on the sheets shown in image below is input from
other sheets in the workbook.

Not sure if this makes a difference but the first column of the selections
have conditional formating to where nothing shows until greater than zero
is filled in.

Though the image below has a space between the subject and first iten in list,
that is not needed.
 

Attachments

  • CondenseData.jpg
    CondenseData.jpg
    168 KB · Views: 11
There are two ways that could be done. One way would be to delete the empty cells in the first column of the selection moving up everything below. The other is by hiding the blank rows. Which would work for you best?
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
There are two ways that could be done. One way would be to delete the empty cells in the first column of the selection moving up everything below. The other is by hiding the blank rows. Which would work for you best?
Delete.
Thanks
 
Upvote 0
There are two ways that could be done. One way would be to delete the empty cells in the first column of the selection moving up everything below. The other is by hiding the blank rows. Which would work for you best?
delete the empty cells in the first column of the selection moving up everything
 
Upvote 0
Try the following: Select the range A161:B183 and run this macro:
VBA Code:
Sub lacogada()
    Application.ScreenUpdating = False
    Dim x As Long, rng As Range
    Dim fRow As Long, lRow As Long, col As Long
    col = Selection.Columns(1).Column
    fRow = Selection.Rows(1).Row
    lRow = Selection.Rows.Count + fRow - 1
    For x = lRow To fRow Step -1
        If Cells(x, col) = "" Or Cells(x, col) = 0 Then
            Cells(x, col).Resize(, 2).Delete
        End If
    Next x
    Cells(fRow, col).Select
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Excellent ... thank you so much ... this will make things so much easier and save me some time.

Is there a way to have it move cells in selected area only ... nothing below it ?
 
Last edited:
Upvote 0
Try:
VBA Code:
Sub lacogada()
    Application.ScreenUpdating = False
    Dim x As Long, y As Long, rng As Range
    Dim fRow As Long, lRow As Long, col As Long
    col = Selection.Columns(1).Column
    fRow = Selection.Rows(1).Row
    lRow = Selection.Rows.Count + fRow - 1
    For x = lRow To fRow Step -1
        If Cells(x, col) = "" Or Cells(x, col) = 0 Then
            Cells(x, col).Resize(, 2).Delete
            y = y + 1
        End If
    Next x
    lRow = Range(Cells(fRow, col), Cells(lRow, col)).Find("", SearchOrder:=xlByRows, SearchDirection:=xlNext).Row
    Cells(lRow, col).Resize(y).Insert shift:=xlDown
    Cells(lRow, col + 1).Resize(y).Insert shift:=xlDown
    Cells(fRow, col).Select
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,416
Messages
6,119,384
Members
448,889
Latest member
TS_711

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