View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Pete McCosh[_5_] Pete McCosh[_5_] is offline
external usenet poster
 
Posts: 59
Default VBA searching a row

Fargo,

the find method returns a range object, and you can then
test the address property directly to get the info you
want.

The following simple code finds the first cell in your
range that contains an "s" and outputs the address to the
immediate window.

Sub FindTheS()

Dim SLoc As Range

Set SLoc = Sheets("Sheet1").Range("A15:M15").Find _
(what:="s", LookIn:=xlValues)

Debug.Print SLoc.Address

End Sub

Merry Christmas, Pete

-----Original Message-----
Howdy,
I want to search a row, say from B2 to O2, for a cell

containing an s and
get the position of that cell, preferably in a format of

number of cells
from the left. I've looked into using .Find, but I

haven't been able to
figure out a way to get the information that I want.

Could any of you point
me to an example involving this scenario, or give me some

pointers?

Thanks a bunch,
Fargo