Delete entire row

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
822
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
 

Some videos you may like

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Kamolga

Well-known Member
Joined
Jan 28, 2015
Messages
1,176
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:

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,307
Office Version
  1. 2010
Platform
  1. Windows
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]
 

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
822
Many thanks Kamolga, the code works perfect. Thanks also for your time spent for my project. Hv a great day
 

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
822
Thank you Rick, the VBA works nicely. Thansk once again for your continued support. Hv a lovely day
 

Watch MrExcel Video

Forum statistics

Threads
1,108,503
Messages
5,523,297
Members
409,509
Latest member
CheekyDevil2386

This Week's Hot Topics

Top