# First Cell In Range Not Searched

• Range a1:iv1 (the entire top row), simply contains the column heading names A,B,C...AA,AB... IT,IU, IV (all possible 256 column names)

Range a2:iv2 contains the series of numbers 1 through 256

If you key in "B", the message box tells you "2"
If you key in "2", the message box tells you "B"

This is my own beginner's exercise.

The following code seems to work for everything except the very first cell in the range.

If I key in "A" the code returns 27, which is actually "AA".

If I key in "1" the code returns "J" (so it is finding the leading numeral 1 in 10).

The code is not searching the first cell in the range.

How may I modify this code to include the first cell (A1)?

• Re: First Cell In Range Not Searched

Trying adding the full syntax for the find method and setting all the options.

• Re: First Cell In Range Not Searched

Also, one of the most helpful tools is the macro recorder if you had used that it should have come up with the correct syntax and done the hard work for you.

HTH

• Re: First Cell In Range Not Searched

Thanks, Reafidy! Now it works like a charm. I did start out with the macro recorder, and played with the code for about an hour, but I was missing the concept of

Code
``````With Worksheets(1).Range("a2:iv2")
Set c = .Find(...``````

which I subsequently found by searching ozgrid.com

That example code which I borrowed lacked all the arguments that you have provided.

I am trying to understand how each argument works, and especially, which arguments did the trick to make my code search the first cell in the range.

I searched in Excel Help, to read up in detail on what the find arguments might mean, but did not seem to find something useful.

• Re: First Cell In Range Not Searched

Quote from Karebac

That example code which I borrowed lacked all the arguments that you have provided.

And thats the important detail that the macro recorder would have given you.

Trying changing a few arguments and see what you get. Add "A" or 1 to more than one cell and change the search direction etc and see what happens.

by the way:

Code
``````[A2] ' the brackets are evaulate.
Range("A1") ' like this``````

## Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!