Hi Amroo
If you need the same number of Rows after the removal of the ones which meet the criteria, you would be better off using:
.EntireRow.Clear
instead of
.EntireRow.Delete
Then have the code finish off with a Sort. Then all blank rows will be pushed to the bottom.
Dave
OzGrid Business Applications
Hi Dave and co, thanks it's that I need so what is the code to finish off with a Sort.(I don't understand "finish off" .
A+mroo
Amroo, try this:
Sub SortOutBlanks()
'Written by Ozgrid Business Applications
'www.ozgrid.com
ActiveSheet.AutoFilterMode = False
Range("A1:C1").AutoFilter
Range("A1:C1").AutoFilter Field:=2, Criteria1:="="
Range("A1:C1").AutoFilter Field:=3, Criteria1:="="
ActiveSheet.UsedRange.Offset(1, 0).SpecialCells _
(xlCellTypeVisible).EntireRow.Clear
ActiveSheet.AutoFilterMode = False
Range("A2:C500").Sort _
Key1:=Range("A2"), Order1:=xlAscending, _
Header:=xlNo, Orientation:=xlSortColumns
End Sub
Dave
OzGrid Business Applications
Bon aprés midi everybody,
I copy an past the Dave's code in a macro and add this followed code to get the table in a setting or frame (well I don't know the exact word of the thing where we put pictures or photos?), and it runs well.
If someone can make it more simple, so I thank him or her in advance.
A+mroo
the code added
Range("A2:C200").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End With
End With
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone