Delete rows with in a range based on cell criteria

Graham JN

New Member
Joined
Apr 15, 2018
Messages
13
Can some one help me i would like to select a range of cells B27 to J61

If a 0 appears in the cell in column B WITHIN THE RANGE then the entire row would be deleted
 

Some videos you may like

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,530
Office Version
  1. 365
Platform
  1. Windows
How about
Code:
Sub delZero()
   Dim i As Long
   For i = 61 To 27 Step -1
      If Range("B" & i).Value = 0 Then Rows(i).Delete
   Next i
End Sub
 

Graham JN

New Member
Joined
Apr 15, 2018
Messages
13
Thankyou for your help it works great, could you help me one more step

Instead of deleting the entire row i would like it only to delete the rows but JUST within column range B to J AND NOT the entire row.

Thanks
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,530
Office Version
  1. 365
Platform
  1. Windows
Try
Code:
Sub delZero()
   Dim i As Long
   For i = 61 To 27 Step -1
      If Range("B" & i).Value = 0 Then Range("B" & i).Resize(, 9).Delete
   Next i
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,109,341
Messages
5,528,146
Members
409,802
Latest member
joeino

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top