Seamus2626
asked on
With Found Cell
Hi, i have some code that finds a cell.
What i want to do is say With Found Cell, delete everything above it, so all rows above that cell
What code would i use?
Thanks
Seamus
What i want to do is say With Found Cell, delete everything above it, so all rows above that cell
What code would i use?
Thanks
Seamus
Something like this maybe?
Public Sub deleterowsabove()
Dim l As Long
For l = 1 To ActiveCell.Row - 1
ActiveSheet.Rows(1).Delete
Next l
End Sub
It should be Rows(l). And you don't need to delete one by one. A simple:
Range("A1:A" & ActiveCell.Row - 1).EntireRow.Delete
would do it all at once.
Range("A1:A" & ActiveCell.Row - 1).EntireRow.Delete
would do it all at once.
Something like:
Range("A1", FoundCell.Offset(-1)).EntireRow.Delete
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry was away there, Rorys was the one that worked for me.
Thanks Everyone
Seamus
Thanks Everyone
Seamus
2) What exactly is With Found Cell? Is it the result of a find? Is it the selected one? If it's a find, how did you find it? With VBA, or manually?
Please be a bit more explicit so we can help you better :)