1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Using Offset in Excel VBA to Return date frm another cell

Discussion in 'Business Applications' started by gjrobbins, Jan 27, 2010.

Thread Status:
Not open for further replies.
Advertisement
  1. gjrobbins

    gjrobbins Thread Starter

    Joined:
    Jan 25, 2010
    Messages:
    30
    Hi

    I am trying to get a date value from one sheet to populate another sheet using the offset function.

    Using:

    Range(Selection, Selection.End(xlDown)).Offset(0, 3)= " (need to show date here from another sheet) "

    Any help would be much appreciated..

    Thanks
     
  2. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,445
    If the location of date on the other sheet's static, just:

    Range(Selection, Selection.End(xlDown)).Offset(0, 3) = Sheets("Sheet2").Range("A1")

    (e.g.).
     
  3. gjrobbins

    gjrobbins Thread Starter

    Joined:
    Jan 25, 2010
    Messages:
    30
    Hi Bomb #21

    Thanks for your help again - this works great but shows the format as numbers - is there a way of forcing the date format to show?
     
  4. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,445
    There's a problem with pre-formatting the "target area" as date format?

    [re "works great", the key to working with "remote" sheets is "explicit" referencing -- Sheets(SheetName).Range(Address)]
     
  5. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,445
    Macro Recorder is your friend. ;)

    Sub test()
    Range(Selection, Selection.End(xlDown)).Offset(0, 3) = Sheets("Sheet2").Range("A1")
    Range(Selection, Selection.End(xlDown)).Offset(0, 3).NumberFormat = "dd/mm/yy"
    End Sub
     
  6. gjrobbins

    gjrobbins Thread Starter

    Joined:
    Jan 25, 2010
    Messages:
    30
    Excellent - Works great

    Is there a way of adding on a Vlookup function onto this Offset string also?

    Ie how can I make it calculate and put the result in the offset cell

    Thankks
     
  7. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,445
    You lost me. More info required.
     
  8. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/897987

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice