View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Find A value in a column and count the rows


set c = Columns("A").Find(what:="abc",lookin:=xlvalues,loo kat:=xlwhole_
if c is nothing then
msgbox("did not find abc")
else
msgbox("found abc at row : " & c.row)
end if

"KWhamill" wrote:

I am not making this up I have been asked to do the following: Create in VBA
such that the code finds a specified date in Column A and then counts the
Number of rows to it and then plugs that number into an Hlookup. So then the
Hlookup goes to that row and gets the appropriate value. so far i have the
following:
Step 1: Find in Column A the specified date that might be typed in a cell
somewhere else, say on the target spreadsheet. I'm sure i can do this part.
Step 2: count the rows from the top in which the date is found? actually now
that i think about it count the rows from the top of the Hlookup. I'm sure i
don't know how to do this.
Step 3 how do i plug this number into an Hlookup. do i just set the row
count equal to r and then stick r in the formula?
if anyone has anygood ideas or better ways of doing the same I'm all ears.
Thank you,
Karl