+ Reply to Thread
Results 1 to 3 of 3

Referencing Closed workbooks...Help!

  1. #1
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143

    Referencing Closed workbooks...Help!

    Hi all...

    I have a macro to archive some daily sales. What i want to do for the procedure below is send the info to a closed workbook rather than the active one. The reason for this is just to keep the active workbook faster.

    So if i wanted say, to append to Workbook "Archive", "Sheet1" which is held in a folder called "Folder" in the C drive, how would i write the reference?

    Answers on a postcard.....

    Thanks for help inadvance,

    Chris

    Dim SourceRange As Range, TargetRange As Range
    Dim SearchRange As Range, LastWrittenCell As Range
    Dim i, n As Integer, k As Integer, j As Integer, ItemToSearchFor
    '--------------------------------------
    ' User definitions
    n = 6 ' number of columns to append
    Set SourceRange = [N2]
    Set TargetRange = Range("BD!A1")
    '--------------------------------------
    Set SearchRange = Range(SourceRange, SourceRange.End(xlDown))
    If IsEmpty(TargetRange) Then
    Set LastWrittenCell = TargetRange
    k = 0
    Else
    k = 1

  2. #2
    Tom Ogilvy
    Guest

    Re: Referencing Closed workbooks...Help!

    Mr. Erlandsen's page (toward the bottom)

    http://www.erlandsendata.no/english/...php?t=envbadac

    also
    http://support.microsoft.com/default...b;en-us;257819
    How To Use ADO with Excel Data from Visual Basic or VBA

    --
    Regards,
    Tom Ogilvy


    "chris100" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi all...
    >
    > I have a macro to archive some daily sales. What i want to do for the
    > procedure below is send the info to a closed workbook rather than the
    > active one. The reason for this is just to keep the active workbook
    > faster.
    >
    > So if i wanted say, to append to Workbook "Archive", "Sheet1" which is
    > held in a folder called "Folder" in the C drive, how would i write the
    > reference?
    >
    > Answers on a postcard.....
    >
    > Thanks for help inadvance,
    >
    > Chris
    >
    > Dim SourceRange As Range, TargetRange As Range
    > Dim SearchRange As Range, LastWrittenCell As Range
    > Dim i, n As Integer, k As Integer, j As Integer, ItemToSearchFor
    > '--------------------------------------
    > ' User definitions
    > n = 6 ' number of columns to append
    > Set SourceRange = [N2]
    > Set TargetRange = Range("BD!A1")
    > '--------------------------------------
    > Set SearchRange = Range(SourceRange, SourceRange.End(xlDown))
    > If IsEmpty(TargetRange) Then
    > Set LastWrittenCell = TargetRange
    > k = 0
    > Else
    > k = 1
    >
    >
    > --
    > chris100
    > ------------------------------------------------------------------------
    > chris100's Profile:

    http://www.excelforum.com/member.php...o&userid=25166
    > View this thread: http://www.excelforum.com/showthread...hreadid=504901
    >




  3. #3
    Jim Thomlinson
    Guest

    RE: Referencing Closed workbooks...Help!

    There is a good discurssion about this in Excel Daily Dose...

    http://www.*****-blog.com/archives/2...ing-workbooks/
    --
    HTH...

    Jim Thomlinson


    "chris100" wrote:

    >
    > Hi all...
    >
    > I have a macro to archive some daily sales. What i want to do for the
    > procedure below is send the info to a closed workbook rather than the
    > active one. The reason for this is just to keep the active workbook
    > faster.
    >
    > So if i wanted say, to append to Workbook "Archive", "Sheet1" which is
    > held in a folder called "Folder" in the C drive, how would i write the
    > reference?
    >
    > Answers on a postcard.....
    >
    > Thanks for help inadvance,
    >
    > Chris
    >
    > Dim SourceRange As Range, TargetRange As Range
    > Dim SearchRange As Range, LastWrittenCell As Range
    > Dim i, n As Integer, k As Integer, j As Integer, ItemToSearchFor
    > '--------------------------------------
    > ' User definitions
    > n = 6 ' number of columns to append
    > Set SourceRange = [N2]
    > Set TargetRange = Range("BD!A1")
    > '--------------------------------------
    > Set SearchRange = Range(SourceRange, SourceRange.End(xlDown))
    > If IsEmpty(TargetRange) Then
    > Set LastWrittenCell = TargetRange
    > k = 0
    > Else
    > k = 1
    >
    >
    > --
    > chris100
    > ------------------------------------------------------------------------
    > chris100's Profile: http://www.excelforum.com/member.php...o&userid=25166
    > View this thread: http://www.excelforum.com/showthread...hreadid=504901
    >
    >


+ 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