VBA: How to delete rows based on the small case letter in a particular column.

Rabiyudeen

New Member
Joined
Oct 13, 2016
Messages
18
S.NO.NAMEAGELOCATION
1JOHN abraham34WASHINGTON
2
ANTONY RAJ

<colgroup><col></colgroup><tbody>
</tbody>
30NEW YORK

<tbody>
</tbody>







Hi everyone,

I need to delete the row in column B if the name has small case letter. For example in JOHN abraham , abraham is in small case so that particular row should be deleted.

I just wanted to know do we able to delete the row based on the small case letter in that particular column. If yes, please let me know the VBA code. Thanks
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
To b explicit, are you saying that if an entire word (name, first or last) is in lower case, delete the row; or, are we looking to find one or more letters in lower case?
 
Upvote 0
Thanks for your response. We are looking to find any one or more letters in lower case (name, first or last ) then the entire row has to be deleted.
 
Upvote 0
Welcome to the MrExcel board!

Try this in a copy of your workbook.

Rich (BB code):
Sub Del_If_Any_Lower()
  Dim a, b
  Dim nc As Long, i As Long, k As Long
 
  nc = Cells.Find(What:="*", After:=Cells(1, 1), LookIn:=xlValues, SearchOrder:=xlByColumns, _
                SearchDirection:=xlPrevious, SearchFormat:=False).Column + 1
  a = Range("B2", Range("B" & Rows.Count).End(xlUp)).Value
  ReDim b(1 To UBound(a), 1 To 1)
  For i = 1 To UBound(a)
    If UCase(a(i, 1)) <> a(i, 1) Then
      b(i, 1) = 1
      k = k + 1
    End If
  Next i
  If k > 0 Then
    Application.ScreenUpdating = False
    With Range("A2").Resize(UBound(a), nc)
      .Columns(nc).Value = b
      .Sort Key1:=.Columns(nc), Order1:=xlAscending, Header:=xlNo, _
            OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
      .Resize(k).EntireRow.Delete
    End With
    Application.ScreenUpdating = True
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,217
Members
448,554
Latest member
Gleisner2

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