PDA

View Full Version : Solved: Use Offset to return a value



YellowLabPro
10-09-2007, 06:24 AM
I cannot get this to work:

If Not IsError(Application.Match(c.Value, Array("SNBD", "SNBB", "SNBT", "SNBJ", "SNBP", "SNBGG", "SNBH", "SNBGL", "SNBPK", "SHOES", "HAT", "BEAN", "TEE"), 0)) _
And Len(Range(c.Offset(0, 55)).Value) < 1 Then


Method of Range Failed
It has to do w/
Range(c.Offset(0, 55)).Value
I can get this to work:
MsgBox Len(Range("BC6").Value)

Posted Here originally:
http://www.mrexcel.com/board2/viewtopic.php?t=295928

Oorang
10-09-2007, 06:37 AM
Is there a valid address string in the cell that c.Offset(0,55) evalutates to?

YellowLabPro
10-09-2007, 06:46 AM
Is there a valid address string in the cell that c.Offset(0,55) evalutates to?

Hi Aaron,
Sorry- could you explain what you mean by valid address string?

Oorang
10-09-2007, 06:58 AM
Well, this code segment:
Range(c.Offset(0, 55)).Value Would evaluate like this:
Find range c evaluates to (we'll say C10). Go over 55 columns, (BF10), and get the value in the cell (because Value is the default property of the range object). If BF10 has something that is not an address, say "foo", then you end up with:
Range("foo").Value

YellowLabPro
10-09-2007, 07:50 AM
I have solved:
I was using Range before c.offset which it did not like. Why I don't know.

Aaron,
Thanks. That is an interesting, I had not considered that point. At the moment I was just looking if the lenght was greater than 0. My problem was as I remarked above was I hade the Range property, which I thought would be required.

Paul_Hossler
10-09-2007, 05:57 PM
Hi

Instead of

Len(Range(c.Offset(0, 55)).Value) < 1

what happens if you use

Len(c.Offset(0, 55).Value) < 1 ??

Paul

YellowLabPro
10-09-2007, 06:04 PM
Thanks Paul,
That is what I did use....