bhrjohnson
Board Regular
- Joined
- Oct 8, 2004
- Messages
- 56
The following macro works well for me except that it leaves many useless lines that all have one thing in common: the text in their A cell is bold, and no other cells except the header (row 1) contain bold text. How can I add a line to the END of this macro that will search all rows (except row 1) and delete the whole row if the A cell of the given row is bold?
Thanks,
Bill
Sub test()
Dim cell As Range, myrange As Range
Application.ScreenUpdating = False
Columns("A:A").Insert shift:=xlToRight
With Range("A1")
.Value = "Family Name"
.Font.Bold = True
.WrapText = True
End With
Set myrange = Range("B2", Range("B65536").End(xlUp))
For Each cell In myrange
If cell.Font.Bold = True Then cell.Cut Destination:=cell.Offset(, -1) Else _
cell.Offset(, -1).Value = cell.Offset(-1, -1).Value
Next
Application.ScreenUpdating = True
End Sub
Thanks,
Bill
Sub test()
Dim cell As Range, myrange As Range
Application.ScreenUpdating = False
Columns("A:A").Insert shift:=xlToRight
With Range("A1")
.Value = "Family Name"
.Font.Bold = True
.WrapText = True
End With
Set myrange = Range("B2", Range("B65536").End(xlUp))
For Each cell In myrange
If cell.Font.Bold = True Then cell.Cut Destination:=cell.Offset(, -1) Else _
cell.Offset(, -1).Value = cell.Offset(-1, -1).Value
Next
Application.ScreenUpdating = True
End Sub