Parsing, mid, left, trim or right to find specific word in string

W

wccc.pctutor

Hi All,

I was hoping to get a hint or two to find a specific word, which I'll
use to determine which worksheet to place the string in.

I would really appreciate only hints as to the process.

Thanks in advance.

Yours truly,

wccc.pctutor
 
J

Jim Cone

Hint: InStr
--
Jim Cone
Portland, Oregon USA



"wccc.pctutor"
<[email protected]>
wrote in message
Hi All,

I was hoping to get a hint or two to find a specific word, which I'll
use to determine which worksheet to place the string in.
I would really appreciate only hints as to the process.
Thanks in advance.
Yours truly,
wccc.pctutor
 
O

Office_Novice

Example: On the First worksheet in cells, A1 & A2 place these two words

A
1 Aardvark
2 Anteater

Then in the VBE paste this,

Option Explicit
Sub DoStuff()
Dim Start As Integer
Dim StringBeingSearched As String
Dim StringBeingSought As String
Dim ws As Worksheet
Dim LastRow As Long
Dim RangeToSearch As Range
Dim i As Variant

Set ws = ActiveWorkbook.Worksheets(1)
LastRow = ws.Cells(Rows.Count, 1).End(xlUp).Row
Set RangeToSearch = Range("A1:A" & LastRow)
Start = 1
StringBeingSought = "Aa"

For Each i In RangeToSearch
If InStr(Start, i, StringBeingSought) Then
MsgBox i
End If
Next
End Sub

Notice that the msgbox only returns Aardvark not anteater. The same can be
applied for any string Hope that helps.
 
W

wccc.pctutor

Hi All,

You guys have been really gracious.

I will be, intently, reading each of your responses' and look each one
up in the Help Section.

If I "fall, stumble or get stuck" I will be back

Again, thank you all for taking the time to answer my post.

Now to my wife's hone-do-list.

Later,

wccc.pctutor

Office_Novice:
 

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