Finding Text in a String

vicedo

Active Member
Joined
Jan 9, 2015
Messages
401
Guyz please, I need help in tweaking this code

Sub Find_CIB()
Dim rngRow As Range, rng2Cut As Range
Dim what As String
what = "CIB-OA" & "Scrubing Account"
Do
Set rng = ActiveSheet.UsedRange.Find(what)
If rng Is Nothing Then
Exit Do
Else
Rows(rng.Row).Delete
End If
Loop
End Sub

Rather than deleting the entire the cell, move the active cell three steps to the right and one step up. In other words, offset active cell (-1, 3)
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Guyz please, I need help in tweaking this code

Sub Find_CIB()
Dim rngRow As Range, rng2Cut As Range
Dim what As String
what = "CIB-OA" & "Scrubing Account"
Do
Set rng = ActiveSheet.UsedRange.Find(what)
If rng Is Nothing Then
Exit Do
Else
Rows(rng.Row).Delete
End If
Loop
End Sub

Rather than deleting the entire the cell, move the active cell three steps to the right and one step up. In other words, offset active cell (-1, 3)

Is the text you want to find a constant value or does the cell contain a formula that is displaying the text you want to find?
 
Upvote 0
The cell contains a text and CIB-OA is part of the text. So am using CIB-OA as a keyword to search. Also Scrubing Account is another text and no keyword for that. All in the same Column A
 
Last edited:
Upvote 0
The cell contains a text and CIB-OA is part of the text. So am using CIB-OA as a keyword to search. Also Scrubing Account is another text and no keyword for that. All in the same Column A
So you are searching for two different text constants then, correct?

When you say "no keyword for that", to you mean the words "Scrubbing Account" is the only text in the cell?
 
Upvote 0
For Scrubbing Account "YES"

and for CIB-OA, I have "CIB-OA First Ban", in a cell
"CIB-OA Zenith Ban" in another cell. So all cells beginning with CIB-OA should offset by (-1, 3), same for scrubbing account
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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