View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Finding a cell with 2 conditions

Sub fi()
Dim taz as Range
set taz = Cells.Find(What:="Job No", _
After:=ActiveCell, LookIn:=xlFormulas,
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
if taz is nothing then
msgbox "Job No not found"
exit sub
else

If taz.Interior.ColorIndex = 37 Then
m = taz.Column
End If
End if
End Sub

--
Regards,
Tom Ogilvy

"T De Villiers" wrote:


Hi,

Trying to write a macro which finds the text "Job No" and if it has
colorindex = 37 then assigns the column number of "Job No" to the
variable m

Below isnt quite working:


Sub fi()

taz = Cells.Find(What:="Job No", After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate


If taz.Interior.ColorIndex = 37 Then
m = taz.Column
End If

End Sub


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=565990