Delete entire row

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
890
Hi all, i would like to use VBA code so that to delete entire row, where in column "A" is number. Due to headings the code should run from "A4" and rows down. Thank you all in advance
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Code:
[COLOR=#008000]'Declare sheet[/COLOR]
 Dim sh As Worksheet: Set sh = ActiveSheet
[COLOR=#008000]'Declare last row[/COLOR]
 Dim lr As Long: lr = sh.Cells(sh.Rows.Count, "A").End(xlUp).Row
[COLOR=#008000]'Declare running row[/COLOR]
 Dim r As Long
[COLOR=#008000]'Loop through rows[/COLOR]
 For r = lr To 4 Step (-1)
    If IsNumeric(Cells(r, 1).Value) Then
        Rows(r).Delete
    End If
 Next r
 
Last edited:
Upvote 0
Does this macro do what you want...
Code:
[table="width: 500"]
[tr]
	[td]Sub DeleteRowsIfNumbersInColumnA()
  Columns("A").SpecialCells(xlConstants, xlNumbers).EntireRow.Delete
End Sub[/td]
[/tr]
[/table]
 
Upvote 0
Many thanks Kamolga, the code works perfect. Thanks also for your time spent for my project. Hv a great day
 
Upvote 0
Thank you Rick, the VBA works nicely. Thansk once again for your continued support. Hv a lovely day
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

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