+ Reply to Thread
Results 1 to 4 of 4

Referencing

  1. #1
    Registered User
    Join Date
    01-28-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Referencing

    I have the following code

    PHP Code: 
        For Each C In Sheets("data").Range("A2"Range("A2").End(xlDown))
        
               
    With C
               
    If IsDate(.ValueThen
                   
    .Offset(03).Value Format(.Value"yyyymmdd")
               Else
                   .
    Offset(03).Value Right(.text4)
               
    End If
           
    End With
        Next C 
    which is supposed to read the cell offset 3 to the right, and then set to either YYYYMMDD or YYYY depenig on the value in the cell.

    I'm not sure how to specify the first part of this line - .Offset(0, 3).Value = Format(.Value, "yyyymmdd") - it keeps reading the cell in column A, rather than the offset cel.

    TIA

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Referencing

    Try using
    Please Login or Register  to view this content.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Referencing

    Hello blinks,

    Change your code to this...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    01-28-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Referencing

    Thank you very much, Paul and Leith.

    The following slight variation on your codes did the trick -

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1