Find the occurrences of the particular word and appear one time

B

Ben

Hi,

How can I write in excel program to find the occurences of the particular
word and the word appear one time only given a particular long list of data
and the particular word such as "Frame" appear a lot of time

thanks.
regards,
ben
 
S

Sharad

You can do it as under. The input box will ask for the word to enter and
will find out how many times it occurs in the active sheet.

Sharad

Sub checkWord()
Dim myWord As String, nwordCount As Integer
myWord = InputBox("Please enter the word to find occurances")
If Len(myWord) = 0 Then Exit Sub
With ActiveSheet
For Each c In .UsedRange.Cells
If c.Value = myWord Then
nwordCount = nwordCount + 1
End If
Next c
End With
If nwordCount = 0 Then
MsgBox """" & myWord & """" & " was not found in the active sheet."
Else
MsgBox """" & myWord & """" & " occurs " & nwordCount & _
" times in the active sheet."
End If
End Sub


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 

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