+ Reply to Thread
Results 1 to 4 of 4

Get Data from another workbook

  1. #1
    Registered User
    Join Date
    07-21-2006
    Posts
    24

    Question Get Data from another workbook

    Hi Guys, how do get data from a cell in a different woorkbook using VBA code

    Thanks

  2. #2
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500
    umm could we have a little bit more info please. not a lot to work with.

  3. #3
    Registered User
    Join Date
    07-21-2006
    Posts
    24
    Ok Sorry,

    In a Cell you can enter a formula i.e C:\Test.xls!GOTOCELLA, so this will get the named cell GOTOCELLA from excel workbook test.xls

    But instead I need to get this formula into VBA

    Hope this makes more sense

    Thanks

  4. #4
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500
    I understand now

    what you need to do is some like this


    Sub example
    dim Data as string

    workbooks.open filename:="C:\test.xls"

    'adding the value to our varible called data
    Data = sheets("Sheet1").Range("a1").value

    application.activewindow.close

    activecell.value = data

    end sub

    this option breaks the link between the to workbooks

    or


    if you know a formula that you would normally type in a cell you can type the following

    range("a1").formual="=sheet1!a1"

    this line will apply that formula to cell a1.

    hope this helps

+ 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