View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
IanC[_2_] IanC[_2_] is offline
external usenet poster
 
Posts: 157
Default Problem finding cell contents


"IanC" wrote in message
...
I have the following code which is causing me a headache. The idea is to
find the current version of an Excel template file. The problem lies in the
section between the rows of hyphens. Things go wrong on the line followed
by asterisks, though I think the problem lies with the previous line.

The partucular file I'm working with does not contain SD so I need t to
step onto the next section looking for sUpdRoot & " v". The problem is
that "cell" obviously contains something and th code jumps to "cont:".

How can I modify the code so that if SD isn't found it will look for
sUpdRoot & " v"?
'Find cell containing "SD" (if any)
Set cell = .Cells.Find(What:="SD", _
After:=.ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False)
On Error GoTo 0
If Not cell Is Nothing Then GoTo cont '************

I'm an idiot (please feel free to disagree). The answer was staring me in
the face. the string SD was being found in the worksheet, but not as I
expected it. It was in the word Tuesday. All I needed to do was change
MatchCase to True.

--
Ian
--