removing specific rows in a worksheet
Hi Eduardo
Thank you for your prompt reply. I can't seem to get this to work. I have
changed the column letter to A and have run the macro but nothing happens? I
have shown below how i have edited the macro - have I done something wrong or
is there something on here still referencing column C, as in your example,
that I've missed?
Sub test()
Dim copyrange As Range
Lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & Lastrow)
For Each c In MyRange
If InStr(c, "Store Manager") Then
If copyrange Is Nothing Then
Set copyrange = c.EntireRow
Else
Set copyrange = Union(copyrange, c.EntireRow)
End If
End If
Next
If Not copyrange Is Nothing Then
copyrange.Delete
End If
End Sub
Thanks again.
Louise
"Eduardo" wrote:
Hi Louise,
Try this backup your file first
I suppose that Store Manager is in column C, change it to fit your
requirements
Sub delete_Me()
Dim copyrange As Range
Lastrow = Cells(Cells.Rows.Count, "C").End(xlUp).Row
Set MyRange = Range("C1:C" & Lastrow)
For Each c In MyRange
If InStr(c, "Store Manager") Then
If copyrange Is Nothing Then
Set copyrange = c.EntireRow
Else
Set copyrange = Union(copyrange, c.EntireRow)
End If
End If
Next
If Not copyrange Is Nothing Then
copyrange.Delete
End If
End Sub
"Louise" wrote:
Hi all
I have a large worksheet containing thousands of rows beginning with the
words 'store manager'. I need to remove every row in the workbook beginning
with these two words.
Is there an easy way to do this?
Thank you.
Louise
|