View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Help with instring code

If InStr(1, Application.Trim(rngCell.Value), "00 total",vbTextCompare)
0 And _
InStr(1, rngCell.Offset(1, -2).Value, "total",vbTextCompare) = 0
Then
rngCell.Offset(2, 0).FormulaR1C1 = "=R[3]C[1]"


Also, if this data is brought down from the web, the space may not be a
space. It may be a non-breaking space. Is this data brought down from the
web?

--
Regards,
Tom Ogilvy


"Elaine" wrote in message
...
I have a line of code that sees if a subtotal contains the text "00

total".
However, some of the totals can be "01 total", "04 total". All totals have

0
as their second last number but not as their last number. Is there an easy
way to correct the following code to take care of this discrepancy?

If InStr(1, LCase(rngCell.Value), "00 total") 0 And _
InStr(1, LCase(rngCell.Offset(1, -2).Value), "total") = 0 Then
rngCell.Offset(2, 0).FormulaR1C1 = "=R[3]C[1]"

--Elaine