nccool2104
New Member
- Joined
- Jul 7, 2014
- Messages
- 3
Hi All,
i have been through the web in search of a solution to my problem but i have been able to get only part of it.
I need to remove specific rows (1) in my excel sheet and rename the headers (2).
Here is the original sheet:
-- removed inline image ---
I need to remove Customer Service and System User and rename the Headers as such:
-- removed inline image ---
I found a macro but it removes only one row at a time:
Sub DeleteJunk()
Dim cell As Range, RangeToDelete As Range
For Each cell In Range(("A1"), Range("A65536").End(xlUp))
If Left(cell, 15) = "Company Pty Ltd" Then
If RangeToDelete Is Nothing Then
Set RangeToDelete = Range(cell, cell.Offset(6, 0)).EntireRow
Else
Set RangeToDelete = Application.Union(RangeToDelete, Range(cell, cell.Offset(6, 0)).EntireRow)
End If
End If
Next
On Error Resume Next
RangeToDelete.EntireRow.Delete
End Sub
Please help
i have been through the web in search of a solution to my problem but i have been able to get only part of it.
I need to remove specific rows (1) in my excel sheet and rename the headers (2).
Here is the original sheet:
-- removed inline image ---
I need to remove Customer Service and System User and rename the Headers as such:
-- removed inline image ---
I found a macro but it removes only one row at a time:
Sub DeleteJunk()
Dim cell As Range, RangeToDelete As Range
For Each cell In Range(("A1"), Range("A65536").End(xlUp))
If Left(cell, 15) = "Company Pty Ltd" Then
If RangeToDelete Is Nothing Then
Set RangeToDelete = Range(cell, cell.Offset(6, 0)).EntireRow
Else
Set RangeToDelete = Application.Union(RangeToDelete, Range(cell, cell.Offset(6, 0)).EntireRow)
End If
End If
Next
On Error Resume Next
RangeToDelete.EntireRow.Delete
End Sub
Please help