Partial Text Strings

fari1

Active Member
Joined
May 29, 2011
Messages
362
hi,
i'm trying to make it work a code, that may find a text string starting with Consolidated out of the whole sheet and with match case True i-e Consolidated

i've a code that finds a text string starting with certain text, but it is not working on my data, as i need to find every cell in the sheet and match case also.any help over it would be greatly appreciated

Code:
Public Sub FindData()
Dim lLastRow As Long
With Sheets("Sheet2")
lLastRow = .Range("A" & Rows.Count).End(xlUp).Row
    For i = 2 To lLastRow
        If InStr(1, .Range("A" & i).Value, "Consolidated") = 1 Then
        .Rows(i).Copy Destination:=Sheets("sheet3").Range("A" & Rows.Count).End(xlUp)(2)
        End If
    Next i
    Application.CutCopyMode = False
End With
End Sub
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Maybe

Code:
Public Sub FindData()
Dim lLastRow As Long
With Sheets("Sheet2")
    lLastRow = .Range("A" & Rows.Count).End(xlUp).Row
    For i = 2 To lLastRow
        If .Range("A" & i).Value Like "Consolidated*" Then
            .Rows(i).Copy Destination:=Sheets("sheet3").Range("A" & Rows.Count).End(xlUp)(2)
        End If
    Next i
    Application.CutCopyMode = False
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,253
Members
452,900
Latest member
LisaGo

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