View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Scott Scott is offline
external usenet poster
 
Posts: 17
Default Selecting or Activating a cell.

Hi,

I've got this code below, from help of course and thank you very much, but
I'm having a little problem with it.
It all works except for an addition I'm trying to add. I'm trying to make it
select or activate the cell when it finds a cell that contains any of the
words listed, but as I'm only a newbie to this sort of stuff I don't really
know how to do this.
Can someone please help,

Dim astrList(5) As String
Dim lngUpperBound As Long
Dim strText As String
Dim lngIndex As Long
Dim lngRow As Long

'set the upperbound of the array
'(number of words it'll contain)
lngUpperBound = 5

'add words to the array
astrList(0) = "BoB"
astrList(1) = "George"
astrList(2) = "Word"
astrList(3) = "Match?"
astrList(4) = "YES"

'look for any matches in col1
For lngRow = 10 To 100
strText = UCase(ActiveSheet.Cells(lngRow, 1).Value)
For lngIndex = 0 To lngUpperBound - 1
If Instr(1,strText,astrList(lngIndex),1) Then
'Select the Cell, but having a bit of trouble here.
'None of these seem to work, Please help.
'strText.Select, strText.Activate, lngRow.Select,
lngRow.Activate
End If
Next
Next


Thanks
Best regards,
Scott