D
davethewelder
Hi all, I have a macro which deletes rows in a report with multiple borders
where it deletes blank rows to compact the print area. Unfortunately one of
the cells loses its bottom border when the row above is deleted.
The cell is the last cell in the range V2:V20 and there is a similar range
below it in row V. The number of rows in the range after deletion is dynamic
so I cannot use an absolute reference. I have added the code I have tried
below but have run out of ideas.
Any help would be appreciated.
Sub filterrows1()
'Dim myrange As Range
Cells.Select
With Selection
Rows("2:200").Select
.AutoFilter Field:=30, Criteria1:="1"
Selection.EntireRow.Delete Shift:=xlUp
ActiveSheet.ShowAllData
' Set myrange = Range("V2:V20")
' myrange.Lastrow.Select
Range(Cells(firstrow, firstcolumn), Cells(Lastrow, lastcolumn)).Select
' LastRow = .Cells(Range("V2:V20").End(xlUp))
With Selection.FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Thanks
Davie
where it deletes blank rows to compact the print area. Unfortunately one of
the cells loses its bottom border when the row above is deleted.
The cell is the last cell in the range V2:V20 and there is a similar range
below it in row V. The number of rows in the range after deletion is dynamic
so I cannot use an absolute reference. I have added the code I have tried
below but have run out of ideas.
Any help would be appreciated.
Sub filterrows1()
'Dim myrange As Range
Cells.Select
With Selection
Rows("2:200").Select
.AutoFilter Field:=30, Criteria1:="1"
Selection.EntireRow.Delete Shift:=xlUp
ActiveSheet.ShowAllData
' Set myrange = Range("V2:V20")
' myrange.Lastrow.Select
Range(Cells(firstrow, firstcolumn), Cells(Lastrow, lastcolumn)).Select
' LastRow = .Cells(Range("V2:V20").End(xlUp))
With Selection.FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Thanks
Davie