Delete all rows under row number 2

Stevenn

Active Member
Joined
Feb 8, 2012
Messages
259
How is it possible to delete everything except Range("A1:D2")? I once saw something using Rows() in which it was specified to delete all rows from row 3. Is there any difference whether it's deleted or cleared? How can I be sure that it wont use memory?
 
Try this
Code:
LR = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
Range("A3:A" & LR).EntireRow.Delete
 
Upvote 0
Thank you. It works. I use

Code:
Rows(row_number & ":" & Rows(row_number).End(xlDown).Row).Select

but it seems like it does not take all my rows. I have the table below, but the code wont delete the row with the smilies (maybe because the two first columns are empty?).

[TABLE="class: grid, width: 256"]
<tbody>[TR]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"].
[/TD]
[TD="align: right"].
[/TD]
[TD="align: right"].
[/TD]
[TD="align: right"].
[/TD]
[/TR]
[TR]
[TD].
[/TD]
[TD].
[/TD]
[TD].
[/TD]
[TD].
[/TD]
[/TR]
[TR]
[TD="align: right"].
[/TD]
[TD="align: right"].
[/TD]
[TD="align: right"].
[/TD]
[TD="align: right"].
[/TD]
[/TR]
[TR]
[TD].
[/TD]
[TD].
[/TD]
[TD].
[/TD]
[TD].
[/TD]
[/TR]
[TR]
[TD="align: right"].[/TD]
[TD="align: right"].[/TD]
[TD="align: right"].
[/TD]
[TD="align: right"].
[/TD]
[/TR]
[TR]
[TD].
[/TD]
[TD].
[/TD]
[TD].
[/TD]
[TD].
[/TD]
[/TR]
[TR]
[TD="align: right"].[/TD]
[TD="align: right"].
[/TD]
[TD="align: right"].
[/TD]
[TD="align: right"].
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]:confused:[/TD]
[TD="align: right"]:confused:[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
those are actually icons so you would need to remove those a little differently. I'll need to search for my information on that - I'll get back to you
 
Upvote 0
so here is the code for deleting shapes that will remove those
Code:
Sub Shapes1()
'Delete all Objects except Comments
    On Error Resume Next
    ActiveSheet.DrawingObjects.Visible = True
    ActiveSheet.DrawingObjects.Delete
    On Error GoTo 0
End Sub
 
Upvote 0

Forum statistics

Threads
1,226,854
Messages
6,193,372
Members
453,792
Latest member
Vic001

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top