PDA

View Full Version : Solved: Resize a table



copyt
04-21-2012, 10:35 AM
Hello all, I have a code to delete data in certain cells in a table.
I want to remove blank cells or shift data after blank cells up.

Any suggestion/help would be appreciated.

Trebor76
04-21-2012, 05:40 PM
Hi there,

Please post your existing code so we can amended it as required.

Robert

copyt
04-21-2012, 11:07 PM
@ Trebor76 (http://www.vbaexpress.com/forum/member.php?u=21682)

Thanks for your response :yes. I have treid this one

Sub resizefinaltable()
'
Dim finalrow As Long
Dim j As Long

finalrow = Cells(Rows.Count, 15).End(xlUp).Row
For j = 4 To finalrow
If Cells(j, 15) = "" Then

Range(Cells(4, 15), Cells(finalrow, 18)).Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Delete Shift:=xlUp

End If
Next j


End Sub

Trebor76
04-21-2012, 11:35 PM
Is that the macro you're using or do you need an entirely new one to be written?

The range used in the macro above doesn't match up to the workbook you've posted :confused:

copyt
04-22-2012, 06:46 AM
Is that the macro you're using or do you need an entirely new one to be written?

The range used in the macro above doesn't match up to the workbook you've posted :confused:

Thanks for your response :yes. In the example file I made it easy to understand my problem.

Trebor76
04-22-2012, 07:46 AM
In the example file I made it easy to understand my problem

That's strange becuase I don't understand :confused:

What's the logic for moving the two items out of the main table into their own area?