Delete entire row if cell contains lower case

Raph85

New Member
Joined
Dec 20, 2015
Messages
26
Hello,

I have a list of data in which I would like to delete the entire row if the text on column A is in lowercase. I am stuck to write a VBA for this one, could anyone help me with this please.

Thank you.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
How about
Code:
Sub delRws()
   Dim i As Long
   For i = Range("A" & Rows.Count).End(xlUp).row To 2 Step -1
      If Range("A" & i).Value = LCase(Range("A" & i).Value) Then
         Rows(i).Delete
      End If
   Next i
End Sub
 
Upvote 0
Hi Fluff,

Thank you for the reply, I tried that but it doesn't really work for me.

I am trying to delete the entire for anything in column A that contains lower case.
 
Last edited:
Upvote 0
How about
Code:
Sub delRws()
   Dim i As Long
   For i = Range("A" & Rows.Count).End(xlUp).row To 2 Step -1
      If Range("A" & i).Value = LCase(Range("A" & i).Value) Then
         Rows(i).Delete
      End If
   Next i
End Sub

I tried the above sub, it worked almost perfectly, it deleted all rows that were lowercase except for the very first row..
maybe the increment numbering needs to be adjusted? am not a vba expert....
many thanks
 
Upvote 0
I don't know..maybe you should clarify if the whole word is in lowercase or only some of it....
I tried the sub of Mr. Fluff, it worked except that the first cell was left untouched...
thanks
 
Upvote 0
wait a min... my bad. Fluff your VBA works perfectly when I tried a new sheet and free type it. But I think there's a format in my original data that doesn't work with the VBA.

Thank you so much Fluff, I'll try to find the issue.
@LFKim2018 - thanks for testing it for me. if you want the first cell maybe change the "Row to 2" to "Row to 1"

Thanks
 
Upvote 0
Found the issue..... not the whole word is in lowercase i.e: Smith/John instead of smith/john.
@Fluff - is there anyway to change it if it's contain any lower case then delete the entire row ?

Thanks heaps.
 
Upvote 0
wait a min... my bad. Fluff your VBA works perfectly when I tried a new sheet and free type it. But I think there's a format in my original data that doesn't work with the VBA.

Thank you so much Fluff, I'll try to find the issue.
@LFKim2018 - thanks for testing it for me. if you want the first cell maybe change the "Row to 2" to "Row to 1"

Thanks

Yes, it did worked alright!
thanks
 
Upvote 0
How about
Code:
Sub delRws()
   Dim i As Long
   For i = Range("A" & Rows.Count).End(xlUp).row To 2 Step -1
      If Range("A" & i).Value <> UCase(Range("A" & i).Value) Then
         Rows(i).Delete
      End If
   Next i
End Sub
 
Upvote 0
How about
Code:
Sub delRws()
   Dim i As Long
   For i = Range("A" & Rows.Count).End(xlUp).row To 2 Step -1
      If Range("A" & i).Value <> UCase(Range("A" & i).Value) Then
         Rows(i).Delete
      End If
   Next i
End Sub

I tried it and I think it did better because if ever an entry is not all caps, then it is deleted; only to make .row To 2 Step -1
to .row To 1 Step -1 so that the first cell can be deleted too. I hope this solved the problem of Mr Raph85... Nice programming Mr. Fluff!
 
Upvote 0

Forum statistics

Threads
1,214,375
Messages
6,119,166
Members
448,870
Latest member
max_pedreira

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