ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find a string with a text paragraph (https://www.excelbanter.com/excel-programming/441313-find-string-text-paragraph.html)

leerem

Find a string with a text paragraph
 
Gents, I need your expertise once again,

I have a fault log (userform) which has a text box placed on it, for
information regarding the fault on hand. However I want to ensure that this
text box isn't used for vulgar words etc.
I have a list of such words held on Sheets("Data").range(B3:B40") and wish
to check this list against the text within the text box.

How do i go about writing a function, that will be able to do such a task.

your assistance would be most appreciated

regards

Lee

Bob Phillips[_4_]

Find a string with a text paragraph
 

If Not IsError(Application.Match(Me.TextBox1.Text,
Sheets("Data").range(B3:B40") , 0) ) Then

MsgBox "Don't be obscene"
Me.TextBox1.Text = ""
End If

--

HTH

Bob

"leerem" wrote in message
...
Gents, I need your expertise once again,

I have a fault log (userform) which has a text box placed on it, for
information regarding the fault on hand. However I want to ensure that
this
text box isn't used for vulgar words etc.
I have a list of such words held on Sheets("Data").range(B3:B40") and wish
to check this list against the text within the text box.

How do i go about writing a function, that will be able to do such a task.

your assistance would be most appreciated

regards

Lee




Mike H

Find a string with a text paragraph
 
Hi,

You could use the after-update event to check the contents against you list

Private Sub TextBox1_AfterUpdate()
Dim MyRange As Range
Set MyRange = Sheets("Data").Range("B3:B40")
If Not IsError(Application.Match(TextBox1.Text, MyRange, 0)) Then
MsgBox "Word not Allowed"
TextBox1.Text = ""
End If
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"leerem" wrote:

Gents, I need your expertise once again,

I have a fault log (userform) which has a text box placed on it, for
information regarding the fault on hand. However I want to ensure that this
text box isn't used for vulgar words etc.
I have a list of such words held on Sheets("Data").range(B3:B40") and wish
to check this list against the text within the text box.

How do i go about writing a function, that will be able to do such a task.

your assistance would be most appreciated

regards

Lee


leerem

Find a string with a text paragraph
 
Many many thanks mike

"Mike H" wrote:

Hi,

You could use the after-update event to check the contents against you list

Private Sub TextBox1_AfterUpdate()
Dim MyRange As Range
Set MyRange = Sheets("Data").Range("B3:B40")
If Not IsError(Application.Match(TextBox1.Text, MyRange, 0)) Then
MsgBox "Word not Allowed"
TextBox1.Text = ""
End If
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"leerem" wrote:

Gents, I need your expertise once again,

I have a fault log (userform) which has a text box placed on it, for
information regarding the fault on hand. However I want to ensure that this
text box isn't used for vulgar words etc.
I have a list of such words held on Sheets("Data").range(B3:B40") and wish
to check this list against the text within the text box.

How do i go about writing a function, that will be able to do such a task.

your assistance would be most appreciated

regards

Lee


Mike H

Find a string with a text paragraph
 
Your welcome
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"leerem" wrote:

Many many thanks mike

"Mike H" wrote:

Hi,

You could use the after-update event to check the contents against you list

Private Sub TextBox1_AfterUpdate()
Dim MyRange As Range
Set MyRange = Sheets("Data").Range("B3:B40")
If Not IsError(Application.Match(TextBox1.Text, MyRange, 0)) Then
MsgBox "Word not Allowed"
TextBox1.Text = ""
End If
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"leerem" wrote:

Gents, I need your expertise once again,

I have a fault log (userform) which has a text box placed on it, for
information regarding the fault on hand. However I want to ensure that this
text box isn't used for vulgar words etc.
I have a list of such words held on Sheets("Data").range(B3:B40") and wish
to check this list against the text within the text box.

How do i go about writing a function, that will be able to do such a task.

your assistance would be most appreciated

regards

Lee



All times are GMT +1. The time now is 11:16 AM.

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