Need a little help in making some code more effecient.
I am importing some data that onto a new sheet that need to be very specific as
it is linked to a number of pivot tables.
I wish to import the raw data and delete a number of rows so that the new column
headings match the old ones. I thought of simply searching and deleting rows
(see code below) but does anyone know if there is a more effecient way, so that
for example, if A1 heading <> A2 heading then delete new data?
Also does anyone know how to repeat this macro until no more results are found?
i.e. until all the unwanted headings have been deleted without continually
repeating the code.
Many thanks ijn advance.
Sub delete()
' Go to the "Heading1" Column.
Rows("2:2").Select
Selection.Find(What:="Heading1", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Select
Range(ActiveCell, ActiveCell.Offset(6536, 0)).Select
Selection.delete Shift:=xlToLeft
Rows("2:2").Select
Selection.delete Shift:=xlUp
Range("A1").Select
End Sub