Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 93
Default VBC 'Contains' Check

Apologies gain, still trying to hack this coders VBA as a non-coder so I can
fix as he is AWOL.

Anyway part of the code was supposed to see if a cell contained specific
text but as I test it it only works on a complete match. This is the line of
code:

ElseIf InStr(UCase(CStr(wsCert.Cells(targetCertRowNumber, 1).Value)),
UCase("TEXT")) And Len(CStr(wsCert.Cells(targetCertRowNumber, 2).Value)) = 0
Then

Do I need to change something so it is finding "TEXT Anything" as right now
it is just finding "TEST"

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default VBC 'Contains' Check

Hi,

Because you posted such a small snippet it's difficult to recreate you code
so here's a general example of how to construct a test with INSTR which
ignores case and finds the text within a longer string.


If InStr(1, "a bit if TEXT to test", "text", vbTextCompare) 0 Then
MsgBox "Found it"
End If
--
Mike

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


"msnyc07" wrote:

Apologies gain, still trying to hack this coders VBA as a non-coder so I can
fix as he is AWOL.

Anyway part of the code was supposed to see if a cell contained specific
text but as I test it it only works on a complete match. This is the line of
code:

ElseIf InStr(UCase(CStr(wsCert.Cells(targetCertRowNumber, 1).Value)),
UCase("TEXT")) And Len(CStr(wsCert.Cells(targetCertRowNumber, 2).Value)) = 0
Then

Do I need to change something so it is finding "TEXT Anything" as right now
it is just finding "TEST"

Thanks in advance

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,522
Default VBC 'Contains' Check

Without seeing all of it, it appears that the test for instr is missing the
0


ElseIf InStr(UCase(CStr(wsCert.Cells(targetCertRowNumber, 1).Value)),
UCase("TEXT"))
0

And Len(CStr(wsCert.Cells(targetCertRowNumber, 2).Value)) = 0
Then


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"msnyc07" wrote in message
...
Apologies gain, still trying to hack this coders VBA as a non-coder so I
can
fix as he is AWOL.

Anyway part of the code was supposed to see if a cell contained specific
text but as I test it it only works on a complete match. This is the line
of
code:

ElseIf InStr(UCase(CStr(wsCert.Cells(targetCertRowNumber, 1).Value)),
UCase("TEXT")) And Len(CStr(wsCert.Cells(targetCertRowNumber, 2).Value)) =
0
Then

Do I need to change something so it is finding "TEXT Anything" as right
now
it is just finding "TEST"

Thanks in advance


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
Increase size of a Forms Check Box (click on to enter check mark) 718Satoshi Excel Discussion (Misc queries) 0 August 17th 07 01:52 AM
Check if Conditional Format is True or False / Check cell Color Kevin McCartney Excel Worksheet Functions 5 June 29th 07 11:12 AM
How do I increase the size of check in check boxes Adams, Les Excel Discussion (Misc queries) 0 September 19th 06 02:35 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"