ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data import/extraction question (https://www.excelbanter.com/excel-programming/332118-data-import-extraction-question.html)

tempacc

Data import/extraction question
 

Hey All,

I receive a weekly statisical report (in excel) from which data must b
added to an existing monthly report (in excel). After researching an
writing a simple macro, I realized I had no idea what I was doing an
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 o
spreadsheet #2, and add it to existing cell/worksheet specific data i
spreadsheet #1.

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

Any help would be greatly appreciated. Thank

--
tempac
-----------------------------------------------------------------------
tempacc's Profile: http://www.excelforum.com/member.php...fo&userid=2440
View this thread: http://www.excelforum.com/showthread.php?threadid=38008


JMB

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




All times are GMT +1. The time now is 12:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com