ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find the occurrences of the particular word and appear one time (https://www.excelbanter.com/excel-programming/318619-find-occurrences-particular-word-appear-one-time.html)

Ben

Find the occurrences of the particular word and appear one time
 
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

Sharad

Find the occurrences of the particular word and appear one time
 
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!


All times are GMT +1. The time now is 04:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com