Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
range to string | Excel Programming | |||
Find the POSITION IN A RANGE of text in a string that matches value(s) in a range | Excel Programming | |||
Retrieving range string from named range | Excel Programming | |||
Translate range name passed as string to a custom function to range addresses! | Excel Programming | |||
Passing a String in Array to Range as String | Excel Programming |