Consulting

Results 1 to 7 of 7

Thread: Solved: Use Offset to return a value

  1. #1

    Solved: Use Offset to return a value

    I cannot get this to work:
    [vba]
    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
    [/vba]

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

    Posted Here originally:
    http://www.mrexcel.com/board2/viewtopic.php?t=295928
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  2. #2
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    Is there a valid address string in the cell that c.Offset(0,55) evalutates to?
    Cordially,
    Aaron



    Keep Our Board Clean!
    • Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
    • Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.

  3. #3
    Quote Originally Posted by Oorang
    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?
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  4. #4
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    Well, this code segment:
    [vba]Range(c.Offset(0, 55)).Value [/vba]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:
    [vba]Range("foo").Value [/vba]
    Cordially,
    Aaron



    Keep Our Board Clean!
    • Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
    • Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.

  5. #5
    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.
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  6. #6
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Hi

    Instead of

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

    what happens if you use

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

    Paul

  7. #7
    Thanks Paul,
    That is what I did use....
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •