+ Reply to Thread
Results 1 to 2 of 2

Data import/extraction question

  1. #1
    Registered User
    Join Date
    06-17-2005
    Posts
    1

    Data import/extraction question

    Hey All,

    I receive a weekly statisical report (in excel) from which data must be added to an existing monthly report (in excel). After researching and writing a simple macro, I realized I had no idea what I was doing and needed dire help. This is what I need the macro to do.

    1) Prompt the user to choose which file from which to extract data.
    (perhaps a "Application.GetOpenFilename"?)

    2) Extract certain cell specific data from a specific worksheet on spreadsheet #2, and add it to existing cell/worksheet specific data in spreadsheet #1.

    3) Be able to reformat and reuse this macro for other uses. (Once I see how the macro works, I should be able to figure this out)

    Any help would be greatly appreciated. Thanks

  2. #2
    JMB
    Guest

    RE: Data import/extraction question

    This may help some. Without details about what is to be copied where, it is
    difficult to address that part of your question.

    this opens a workbook, then copies the data from cell "A1" of the
    activesheet (of the source workbook) to my destination sheet (Sheet1 - I'm
    using the codename for the worksheet). the destination range is column A of
    the next available row of the worksheet.


    Sub ExtractData()
    Dim SourceWkBk As Workbook
    Dim DestWkSht As Worksheet
    Dim DestRow As Long

    On Error Resume Next
    Set DestWkSht = ThisWorkbook.Worksheets(Sheet1.Index)

    If IsEmpty(DestWkSht.UsedRange) Then
    DestRow = 1
    Else: DestRow = DestWkSht.UsedRange.Rows.Count + 1
    End If

    If Application.Dialogs(xlDialogOpen).Show Then
    Set SourceWkBk = ActiveWorkbook
    Else: Exit Sub
    End If

    SourceWkBk.ActiveSheet.Range("A1").Copy _
    DestWkSht.Cells(DestRow, 1)

    SourceWkBk.Close

    End Sub


    "tempacc" wrote:

    >
    > Hey All,
    >
    > I receive a weekly statisical report (in excel) from which data must be
    > added to an existing monthly report (in excel). After researching and
    > writing a simple macro, I realized I had no idea what I was doing and
    > needed dire help. This is what I need the macro to do.
    >
    > 1) Prompt the user to choose which file from which to extract data.
    > (perhaps a "Application.GetOpenFilename"?)
    >
    > 2) Extract certain cell specific data from a specific worksheet on
    > spreadsheet #2, and add it to existing cell/worksheet specific data in
    > spreadsheet #1.
    >
    > 3) Be able to reformat and reuse this macro for other uses. (Once I see
    > how the macro works, I should be able to figure this out)
    >
    > Any help would be greatly appreciated. Thanks
    >
    >
    > --
    > tempacc
    > ------------------------------------------------------------------------
    > tempacc's Profile: http://www.excelforum.com/member.php...o&userid=24406
    > View this thread: http://www.excelforum.com/showthread...hreadid=380085
    >
    >


+ 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