excel vba to remove all rows that have only a value in column E and ignore blanks

BORUCH

Well-known Member
Joined
Mar 1, 2016
Messages
528
Office Version
  1. 365
Platform
  1. Windows
hi

i have the below sheet
Book1
ABCDEFGHIJK
11ITEMDESCRIPTIONmisc info 1misc info 2misc info 3misc info 4misc info 5misc info 6misc info 7misc info 8misc info 9
1200000MISC 1$1.001$1.001$1.001$1.00
1300001MISC 2
1400003MISC 3
15
1600004MISC 5$1.003$55.001$1.001$1.00
1700005MISC 6
18
1900006MISC 8$45.00
2000007MISC 9
21
2200008MISC 11$1.001$1.001$1.001$1.00
2300009MISC 12
24
2500010MISC 14$1.001$1.001$1.001$1.00
2600011MISC 15
2700012MISC 16
28ab123MISC 17
29
30ASD111MISC 19$67.00
31222222MISC 20
3233333MISC 21
33444MISC 22
3455555MISC 23
Sheet1



i would like to remove all rows that only have a value in column E and ignore all empty rows

thanks
 

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"
Never use merged cells, especially when using VBA.
This might work for you

VBA Code:
Sub jec()
 Dim it
 For Each it In Range("A2", Range("A" & Rows.Count).End(xlUp)).SpecialCells(2).Offset(, 4).Areas
   If Len(it.Offset) And IsEmpty(it.Offset(, 1)) Then it.EntireRow.Delete
 Next
End Sub
 
Upvote 0
Never use merged cells, especially when using VBA.
This might work for you

VBA Code:
Sub jec()
 Dim it
 For Each it In Range("A2", Range("A" & Rows.Count).End(xlUp)).SpecialCells(2).Offset(, 4).Areas
   If Len(it.Offset) And IsEmpty(it.Offset(, 1)) Then it.EntireRow.Delete
 Next
End Sub
im getting an error type mismatch
 
Upvote 0
and now?

VBA Code:
Sub jec()
 Dim r, i As Long
 Set r = Range("A2", Range("A" & Rows.Count).End(xlUp)).SpecialCells(2).Offset(, 4).Areas
 
 For i = r.Count To 1 Step -1
   If Len(r(i).Offset) And IsEmpty(r(i).Offset(, 1)) Then r(i).EntireRow.Delete
 Next
End Sub
 
Upvote 0
and now?

VBA Code:
Sub jec()
 Dim r, i As Long
 Set r = Range("A2", Range("A" & Rows.Count).End(xlUp)).SpecialCells(2).Offset(, 4).Areas
 
 For i = r.Count To 1 Step -1
   If Len(r(i).Offset) And IsEmpty(r(i).Offset(, 1)) Then r(i).EntireRow.Delete
 Next
End Sub
same error on this code
VBA Code:
If Len(r(i).Offset) And IsEmpty(r(i).Offset(, 1)) Then
 
Upvote 0
is there a workaround ? i need to have it merged
 
Upvote 0

Forum statistics

Threads
1,215,102
Messages
6,123,099
Members
449,096
Latest member
provoking

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