Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Specifying a string in a range

Hi Norman,

Thanks for replying, can you also spell what the function means, sorry
amstilla novice wiht VB...

Thanks again!
SV



On Apr 11, 11:14 am, "Norman Jones"
wrote:
Hi SV,

Try replacing:

If sht.Range("A" & i) = "US" Then


with

If InStr(1, sht.Range("A" & i).Value, "US", vbTextCompare) Then

--
Regards,
Norman

"SV" wrote in message

ups.com...



Hi,


I'm using this function to help me count and hide rows in my sheet,


If G5 = True And sht.Name = "Patient Summary" Then


lastRow = sht.UsedRange.Rows.Count + sht.UsedRange.Row - 1


For i = 1 To lastRow
If sht.Range("A" & i) = "US" Then
sht.Rows(i & ":" & i + 8).EntireRow.Hidden = True
End If
Next i


But i'm hitting a road block in terms of specifying a cell on this
SAME SHEET which has more than the word "US" for example if it says
"Drug treated US" or "Incidence US" etc, then how do i tackle the
issue especially when its all on the same sheet. Is it something to do
with string function?


Any help would be greatly appreciated,


thanks!!!
SV- Hide quoted text -


- Show quoted text -



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Specifying a string in a range

Hi SV,


'-------------
Thanks for replying, can you also spell what the function means, sorry
amstilla novice wiht VB...
'-------------

See the Instr function in VBA help.

However, the function returns the position of a substring
(your search string 'US') within another string - in your case,
the cell value.

The first parameter specifies the start position of the search;
the second argument specifies the string to be searched; the
third specifies the search string ad the last argument defines
the search method; in this instance the search is case insensitive.

The If construct employed results in an implicit boolean
conversion of the function result: a result of zero (not found) is
returned as False; any other value is returned as True.


---
Regards,
Norman


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Specifying a string in a range

It WORKS!! Thanks so much Norman!!!

SV


On Apr 11, 12:02 pm, "Norman Jones"
wrote:
Hi SV,

'-------------
Thanks for replying, can you also spell what the function means, sorry
amstilla novice wiht VB...
'-------------

See the Instr function in VBA help.

However, the function returns the position of a substring
(your search string 'US') within another string - in your case,
the cell value.

The first parameter specifies the start position of the search;
the second argument specifies the string to be searched; the
third specifies the search string ad the last argument defines
the search method; in this instance the search is case insensitive.

The If construct employed results in an implicit boolean
conversion of the function result: a result of zero (not found) is
returned as False; any other value is returned as True.

---
Regards,
Norman



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
range to string usadream[_9_] Excel Programming 5 April 5th 06 03:30 PM
Find the POSITION IN A RANGE of text in a string that matches value(s) in a range Cornell1992 Excel Programming 0 March 14th 06 07:19 PM
Retrieving range string from named range clapper Excel Programming 4 October 13th 05 03:09 PM
Translate range name passed as string to a custom function to range addresses! agarwaldvk[_25_] Excel Programming 3 September 7th 04 12:47 PM
Passing a String in Array to Range as String [email protected] Excel Programming 2 September 1st 04 01:13 AM


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

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

About Us

"It's about Microsoft Excel"