tourcd
IS-IT--Management
- Dec 5, 2005
- 37
Hi,
I've got the following macro which runs through my spreadsheet looking for the word 'Heading' in column A. It deletes any row which contains the word 'Heading', great. However I would like it to keep the first occurance of 'Heading' and then continue to delete the rest. I'd then like it to loop through and do the same for 'Heading2' etc.
Can anyone point me in the right direction?
Public Sub FormatInput()
'
' FormatInput Macro
'
' Turn off screen updating to speed up macro.
Application.ScreenUpdating = False
Dim T As Range
Dim SrchRng
Set SrchRng = ActiveSheet.Range("A1", ActiveSheet.Range("A65536").End(xlUp))
Do
Set T = SrchRng.Find("Heading", LookIn:=xlValues)
If Not T Is Nothing Then T.EntireRow.Delete
Loop While Not T Is Nothing
'
' Turn screen updating back on.
Application.ScreenUpdating = True
End Sub
I've got the following macro which runs through my spreadsheet looking for the word 'Heading' in column A. It deletes any row which contains the word 'Heading', great. However I would like it to keep the first occurance of 'Heading' and then continue to delete the rest. I'd then like it to loop through and do the same for 'Heading2' etc.
Can anyone point me in the right direction?
Public Sub FormatInput()
'
' FormatInput Macro
'
' Turn off screen updating to speed up macro.
Application.ScreenUpdating = False
Dim T As Range
Dim SrchRng
Set SrchRng = ActiveSheet.Range("A1", ActiveSheet.Range("A65536").End(xlUp))
Do
Set T = SrchRng.Find("Heading", LookIn:=xlValues)
If Not T Is Nothing Then T.EntireRow.Delete
Loop While Not T Is Nothing
'
' Turn screen updating back on.
Application.ScreenUpdating = True
End Sub