Delete Entire row if A is blank starting at row 3 not working

zone709

Well-known Member
Joined
Mar 1, 2016
Messages
2,079
Office Version
  1. 365
Platform
  1. Windows
Code:
[FONT=Calibri][SIZE=3][COLOR=#000000]Sub QuickCull2Test() 'Delete if C is blank but starting atrow 3'
[/COLOR][/SIZE][/FONT][FONT=Calibri][SIZE=3][COLOR=#000000]Intersect(Columns("A"),ActiveSheet.UsedRange).Offset(3).SpecialCells(xlBlanks).EntireRow.Delete     <-- breaks
[/COLOR][/SIZE][/FONT][FONT=Calibri][SIZE=3][COLOR=#000000]End Sub[/COLOR][/SIZE][/FONT]

Breaks not sure why the cell seems blank to me
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
So how would I get this to work then remove the
Intersect
? This is a new sheet I'm working on maybe something changed I just couldn't figure out why its not working. Or do I need to use an updated code for it to work? thanks
 
Upvote 0
Code:
[FONT=Calibri][SIZE=3][COLOR=#000000]Sub QuickCull2Test() 'Delete if C is blank but starting atrow 3'
[/COLOR][/SIZE][/FONT][FONT=Calibri][SIZE=3][COLOR=#000000]Intersect(Columns("A"),ActiveSheet.UsedRange).Offset(3).SpecialCells(xlBlanks).EntireRow.Delete     <-- breaks
[/COLOR][/SIZE][/FONT][FONT=Calibri][SIZE=3][COLOR=#000000]End Sub[/COLOR][/SIZE][/FONT]
Breaks not sure why the cell seems blank to me
I am not sure why that is happening for you (unless all the cells in Column A are blank in which case you could not offset them), but you do not to intersect Column A with the UsedRange as the SpecialCells function automatically restricts itself to the UsedRange. Given that, this code line should work for you...
Code:
Range("A3:A" & Rows.Count).SpecialCells(xlBlanks).EntireRow.Delete
 
Upvote 0
no some cells are blank some are not. The only thing I am trying to do is if any cells in column A are empty or blank then delete entire row. I changed the code and added what you posted and here are the results as I think the top rows moved. If the case on changing the range to A100:A then ill do that ? These are the results as you can see rows are still there even that some in A are blank.

Excel 2016 (Windows) 32 bit
A
1
payroll_number
2
don't put values in this column
3
02182018​
4
02182018​
5
02182018​
6
02182018​
7
02182018​
8
02182018​
9
02182018​
10
02182018​
11
02182018​
12
02182018​
13
02182018​
14
15
02182018​
16
02182018​
17
18
19
02182018​
20
21
02182018​
22
23
24
25
26
27
02182018​
Sheet: Sheets1
 
Upvote 0
I think I know why. Cause I changed some columns to Text to columns delimted because my formulas wouldn't work. This should do the trick



Columns("A").TextToColumns , xlDelimited, , , False, False,False, False, False
 
Upvote 0

Forum statistics

Threads
1,214,559
Messages
6,120,203
Members
448,951
Latest member
jennlynn

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