Modify A Macro To Recognize Case Sensitive

C

carl

I am using this macro graciously provided by a group member. I am trying to
modify it so that it is case sensitive to the values in ColA.

Thank You in advance for your help.

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long
Dim wks As Worksheet

Set wks = Worksheets("Sheet1")

With wks
FirstRow = 2 'headers in row 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

.Range("A1:C" & LastRow).Sort _
key1:=.Range("A1"), order1:=xlAscending, _
key2:=.Range("c1"), order2:=xlAscending, _
key3:=.Range("b1"), order3:=xlAscending, _
header:=xlYes

For iRow = LastRow To FirstRow + 1 Step -1
If .Cells(iRow, "A").Value = .Cells(iRow - 1, "A").Value _
And .Cells(iRow, "C").Value = .Cells(iRow - 1, "C").Value Then
.Cells(iRow - 1, "B").Value _
= .Cells(iRow - 1, "B").Value _
& ";" & .Cells(iRow, "B").Value
.Rows(iRow).Delete
End If
Next iRow
End With

End Sub
 
D

Dave Peterson

That would make the comparison non-case sensitive.

But maybe that's what the OP really wants???
 
R

Ron Rosenfeld

I am using this macro graciously provided by a group member. I am trying to
modify it so that it is case sensitive to the values in ColA.

Seems to me it should be case sensitive as written, unless you've got an

Option Compare Text

statement at the beginning of your module. If so, just remove it.

If you want the comparison to be case insensitive, then add

Option Compare Text

prior to the start of your procedure.
--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top