macro to Delete rows where there are blank rows from Row 12 in Col P but data in Col F

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,566
Office Version
  1. 2021
Platform
  1. Windows
i have tried to write code to delete blank rows in Col P from row 12 onwards where there s Data in Col F

when running the macro no rows are being deleted on sheet "Analysis"

kindly amend my code below



Code:
 Sub Del_BlankRows()
Dim LR As Long, I As Long
With Sheets("Analysis")
LR = Range("f" & .Rows.Count).End(xlUp).Row
For I = LR To 12 Step -1
On Error Resume Next
.Columns(I, 10).SpecialCells(xlCellTypeBlanks).EntireRow.Delete

On Error GoTo 0
Next I
  End With
  
End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
May be
VBA Code:
 Sub Del_BlankRows()
Dim LR As Long, I As Long
With Sheets("Analysis")
LR = Range("f" & .Rows.Count).End(xlUp).Row
For I = LR To 12 Step -1
If .Cells(I, "P").value = "" and .Cells(I, "F").value<>"" then .Cells(I, "P").EntireRow.Delete
Next
End with
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,215,514
Messages
6,125,269
Members
449,219
Latest member
daynle

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