Building Macro To Extract Data From One File Into Another Different File

Feb 21, 2014

I need to set up an automated process to open an existing .xls file, extract the data from specific cells located in that file and insert it into a totally different file that I have preformatted to accept this data.

Example scenario:

If I have "that_file.xls" and it is unopened, but it contains data in cells "A2 thru F2" that I need to extract... then I have "this_file.xls" , which is open, and set up with all my calculation cells and a specific layout (lets say it has cells "D8, E9, F10, G11, H12, and I13"). I want to be able to add a button to "this_file.xls" to run a macro that would open a file search window where I can select "that_file.xls", and then it will automatically extract the data from "that_file.xls" into "this_file.xls" as follows:

A2 to D8
B2 to E9
C2 to F10
D2 to G11
E2 to H12
F2 to I13

View 4 Replies


ADVERTISEMENT

Macro: Building File List

Dec 15, 2009

I want to build a file(name) list of all files in a directory including the ones in all underlying subfolders on any level.

E.g. make at total list of all possible files (not folder-names) in the given directory.

I have a clue, but I just manage to list the files in the first subfolder level - not proceed "deeper" in the folder tree.

View 9 Replies View Related

Extract Data And File Names From File In Folder And Paste Into One Sheet?

Jan 13, 2013

The code below looks at file names in column A and then goes to a folder and opens and copies the data in range c2 -lastrow from each file and pastes the data into sheet2.

how I could add to the code so that it also inserts the file name in column c?

It would make it easier to track the data in column B.

VB:
Sub CopyFromFile()
Dim fPath As String
Dim lRow As Long

[Code].....

I have attached a sample workbook. The list of file name is in sheet 1. An example of the output is in sheet 2. The data in column A is dummy data generally spans 100's of rows not just 10 as in the example.

The purpose of the code is to be able to put a list of file names in column a in sheet 1 and extract data from those files in a folder. The data extraction works fine. The reson for adding the file names is so that I know what file the data came from.

View 1 Replies View Related

Export Data From A Template File To Total List File Using Macro In Template File

Dec 18, 2012

I have a template file for ordering trafolyte and steel plates. I have added macros to this template file. The existing macros do the following (shortly described):

Macro 1: clears order
Macro 2: update order date + send a read only file to the supplier of plates + save a read only copy of the file into one of three folders acc to info in one of the cells.

It's the Macro 2 I want to edit.

I want to add a "function" which copy a selection of data.column A to N from row 12 to 548 but only the rows where there is a value in column A.

Row 1 to 11 includes standard order info and Macro buttons.
Row 11 includes the heading for order data.

For everytime someone click on the Macro 2 button in the template file, I want the selection to be paste into the first "available" row in a "Total list" file.

The "Total list" file may have to be open (or a function to open, paste selection and then close the "Total list" file may be added)

File and Folder info:

To simplify suggestions, the following file and path info can be used (I can change to the correct later):
Template file name: template_order.xlsm
Template file location: \servershared emplate

Total list file name: total_list.xlsx
Total list file location: \servershared otal

Selection info:

The template file exists of a "general order info area" A1:N10
The column heading for order data is located at A11:N11
The selection to be copied is A12:N550 - But only rows where column A includes data (not empty).
(If the spesific order consists of 14 plates than there will be item no 1-14 in column A and I then I want to copy A12:N25 (row 25 will be item 14).

When I try to use record macro it looks like it only records what's happening in the template file - It doesn't record the pasting in the total list.

View 1 Replies View Related

Macro/function To Take Data From Source File Into Base File

Jun 24, 2006

I have a base excel file for summarizing some data, the problem is that the data comes from a different excel spreadsheet. What I want to do is make a function that pulls the data from another spreadsheet into my base file. It would be easy if it were just one excel sheet, but this job would require where the data is pulled from a data file which has many modified versions.

Can anyone tell me how to do this? The files with the data will be structured the exact same but with different data entered in. I just want a button so I can click the file I want the data from and have it show up on my summarizing base file.

View 9 Replies View Related

Excel 2010 :: Building Text File Based On Values Of Cell?

Feb 26, 2014

I'm trying to use Excel to build a text file based on values from certain cells in Excel 2010. This is based partially off of static text that never changes and variables that will need to change. For example, I want Excel to output a text file that has the following text: The red fox jumped over the $X twice. I would want $X to be replaced by the value of A1 of the active worksheet. I will also have several lines like that, so it won't just be a single line, but anywhere from 20 - 120.

View 1 Replies View Related

Extract Data From One File To Another

Apr 13, 2009

I have a report that is downloaded off a company database and creates a report that is attached.
Is there a way to create a macro to extract some data that I need and leave the rest:

I need to keep and everything in the assigned column
PB ID (A3), Issue (B3), Group Code (J3), Group Name (K3), Sub group id (L3), Sub Group Name (M3),Subject ID (L3), Subject Group Name (M3), Subject ID (N3), Subject (O3), PB Status (P3), CPM Report Name (T3), CPM Profile Name (U3), Profile State (V3).

The worksheet's name changes so I can't reference the worksheet. Attached is a copy of what I get when downloaded.

View 11 Replies View Related

Extract The Data From Each File

Jan 24, 2010

I have my Excel workbook open with 690 files hyperlinked to the specific folder on my documents, if I click one link the folder opens fine with the file I am looking for.

What I need is one of you genius's to invent a code so that I can highlight my 690 files and extract the data from each file and input that into a seperate workbook.

View 9 Replies View Related

Extract Subset Of Data From .csv File

Oct 21, 2008

I would get the End of day bhavcopy from the exchange which is a .csv file. The first column contains the column heads like name, open price etc. and the first column. Now I have to extract the names and the corresponding column values from this list by referring to a notepad that contains the ticker names to be extracted, place in another workbook and save that file.

View 10 Replies View Related

Extract Data From Text File

Feb 10, 2012

My data looks like this - it's a text file that I import into Excel.

What I'm looking for is operations that require welding, as indicated by the "Weld:" in Row 61. If it is a weld operation, I want to know the time (121.705) and the Operator involved (Opr 2 - Row 64).

I'm simply using an IF statement in a loop to extract these specific cells:

Range("N2").Select
Do
ActiveCell.FormulaR1C1 = "=IF(MID(RC[-13],11,5)=""Weld:"",LEFT(RC[-13],3),"""")"
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(0, -13))

Because I don't know how to write "real" code, it does a similar loop 5 times. Once to pull the sequence number (the first number), then the time, then I have 3 separate columns looking for Operator 1, 2 or 3, respectively. Once those 5 loops are complete there is a pivot table that summarizes the sequences for each operator.

It works fine, but it's slow. Some of the text files have 10,000 lines in them.

View 9 Replies View Related

Extract Data From A Source File

Mar 7, 2007

I need to extract data from another source file using VBA. I have problems copying the extracted data and format into the required data format. And also, how do i delete the row that is not required in the output file, in the below example: The row, D0, is not needed. An Example Data Format From the SOURCE file:...............

View 2 Replies View Related

Excel 2007 :: Extract Data From File

Feb 12, 2014

Extracting data from an excel file, the data needed in lies in one column.

in this line

<GPSPosition pntRef="GPS_Auto_0080" wgsLatitude="33.334329659885" wgsLongitude="44.405736558207" wgsHeight="27.615921">

i need to get a table with three columns shows

wgsLatitude, wgs Longitude , wgsHeight
33.334329659885 ,44.405736558207 , 27.615921
etc

and get rid of all other information

this is an example of the how the file look like

---------Column N -------------------
</Feature>
</GPSPosition>
</GPSSetup>
<GPSSetup id="GPSSetupID_18" GPSReceiverDetailsID="GPS_1" antennaHeight="1.660000" stationName="GPS_Auto_0080">
<GPSPosition pntRef="GPS_Auto_0080" wgsLatitude="33.334329659885" wgsLongitude="44.405736558207" wgsHeight="27.615921">

[code].....

seems from above that there are too many data not needed the only thing need to be exracting is one lies of GPSPosition Line.

View 2 Replies View Related

Extract Raw Data From Text File Into A Layout

Feb 4, 2014

I need a macro created, which extracts data from the text file, and displays the low level detail which is on the text file.

I have created a sample of the desired results on a tab called "Low Level Results".

I have already created a macro already which extracts data from the text file, but this gives me a high level view and the results of this is on the tab "High Level Results" ( which you might be able to adapt)

Please find attached two files,
Text File,
And Excel spreadsheet

View 2 Replies View Related

Extract Data From Non-structured Text File

Sep 17, 2006

I have a text file (EP-User.txt) contains records of User information like the example below:

[User]
org_id=HR
uid=JohnChen
role=employee
email_address=John@etex.com
first_name=John
last_name=Chen
job_title=Manager
country=USA
language=EN
time_zone=GMT-8
street=3
city=MX
state=NY
zip=123456
telephone=09847684
fax=23469483.....................

The fields of each User record may not appear in sequence and some of the fields may not appear in other User record. The file contains thousands of User records.

1. I need to extract the User records (only certain fields) into excel for data analysis and manipulation (fill-in missing value in certain fields).

2. After analysis and manipulation in excel, I need to export the data back to the original text file format again.

View 9 Replies View Related

VBA - Download Excel File From Internet And Then Extract Data Out Of It

Dec 20, 2012

I'm trying to download an Excel file from the internet and then extract data out of it. The problem is that I don't get any errors, yet the file downloaded is only 1kb in size. The extraction bit works, but the file is empty. The actual file is size 350KB.

Code:
Sub ExtractDataTest()

Dim FileNum As Long
Dim FileData() As Byte
Dim MyFile As String
Dim WHTTP As Object

On Error Resume Next

[Code] ....

View 1 Replies View Related

Extract Data Of Different Width From Text File To Excel Using VBA?

Jan 15, 2014

I am looking to import data in text file to Excel sheet. Here is the main catch - All the data are not of fixed length and are in multiple lines as in the example below.

Text File:
ID001 Dr Dang 01012011 Male
USA Married 123

Below is how I expected the data extraction in Excel:
ColumnA ColumnB
CardID ID001
Name Dr Dang
DOB 01012011
Sex Male
Country USA
Status Married
Pin 123

View 3 Replies View Related

Extract Data From A Specific Location In A Text File

Aug 7, 2006

I have been trying to work this out by looking at other posts (mostly concerning Binary Access) but can't figure it! The source text files I am using can vary in length from 4,000 characters to well over 100,000 characters. However the data I am looking for always starts 40 characters from the end of the file and is 10 characters long! I need my macro to pick out this data and store it as a string (so it can be added to an array and exported to a worksheet later)

View 2 Replies View Related

Macro To Download Csv File From A Dynamic Date Based Url To A File Location

Feb 23, 2014

I have a requirement to download a lot of historical data files from the archieve of an website. The url goes something like this: [URL]....

This downloads file for 21022014 ie. 21-Feb-2014. I need to be able to have a facility to have a selection criteria on my user form (in excel) where I specify a date range and the macro automatically downloads all the valid excel files available within that date range (files for Saturday, Sunday and some holiday dates will not be available in the website archive database) one after the other (like at single clcik of button) into a specific location (predefined viz.. c:/Users/EOD files/) on my laptop. Best would be if I am able to select the save location run time by using a 'Browse' like feature where I go and choose my local laptop folder...same type when we try uploading a file from our laptop to the web..

View 1 Replies View Related

VBA For Bypassing Replace File Prompt When Saving As A File In Macro

Jul 7, 2008

I am setting up a "save as" macro that saves a file by replacing another file in a folder. Even though the macro has been recorded by approving the replacement (the prompt appears "the file --- already exists. Do you want to replace the existing file?"), when I run the macro, I am again prompted about replacing the file. Is it possible to avoid the prompt so the file is automatically saved by replacing the named file?

View 9 Replies View Related

Macro To Open File Saved In Same Location But File Name Changes With Each Date

Feb 8, 2013

I do routine tasks every day which involves opening 3 different files and pasting data into my main file. The data is always in the same format, and the 3 files are saved in the same location (3 different folders through). The 3 files are saved each day and the naming convention is constant, with only the date changing. For example, the files are always saved in C:My Documents and the files are called test_05.02.2013.xls. Tomorrow the file will be called test_06.02.2013.xls and so on.

So each day I will be rolling a file forward and I want to bring in the info from each of these files based on the new day.

How to do 1, and I will do the others (because the concept will be the same).

View 1 Replies View Related

Macro To Save Worksheet As New File Then Return To Original File

Mar 14, 2014

I have a macro which successully saves a worksheet as new file to another file path....(below)...but I can't figure out how to close this new file and return to the original file...

Dim myPath As String, fName As String
myPath = Sheets("Date").Range("C8").Text
fName = Sheets("Date").Range("C9").Text
Sheets("Sage CSV File").Copy
With ActiveWorkbook
.SaveAs Filename:=myPath & fName
End With'

View 2 Replies View Related

Changing Reference From Current Years File Data To Blank File Data

Feb 19, 2014

I have a blank file and a data file for current year with formulas.

So I am trying to take a couple of tabs from current year data file and pasting them into the blank file.

My question when is do that all the formulas get referenced to the current years file. i want to keep the same formulas but reference the tabs on blank file.

Is there a quicker way to do this rather and going into all the cells and changing reference from current years files data to blank files data.

View 3 Replies View Related

Macro To Select All Worksheet And Save File As File Name?

Mar 6, 2012

I want to create a macro that will select all the worksheets (names and quantity will vary) and saves the file as the current file's name but in PDF. Since I only know how to record a macro it specifies the worksheet names but I need it for various workbooks. The name will vary plus the number of tabs can go anywhere from 3 to 40.

View 9 Replies View Related

Macro Error - First Sheet In Each File To Master File

Mar 7, 2012

I am receiving an error at

Set CopyRng = Wkb.worksheet1.Range(Cells(RowofCopyworksheet, 1),
Cells(Cells(Rows.Count, 1).End(xlUp).Row, Cells(1, Columns.Count).End(xlToLeft).Column))

I am trying to copy the first sheet in each file in the designated folder and paste it into a master worksheet.

Below is the code.

'Description: Combines all files in a specific folder to Format File for Upload.xls
Sub MergeMultipleFiles()
Dim path As String, ThisWB As String, lngFilecounter As Long
Dim wbDest As Workbook, shtDest As Worksheet, ws As Worksheet
Dim filename As String, Wkb As Workbook
Dim CopyRng As Range, Dest As Range
Dim RowofCopySheet As Integer

[Code] ....

View 1 Replies View Related

Macro: Save File & Automatically Overwrite Old File

Oct 11, 2006

I presently have a macro that, when run, takes to conents of C4 and C6 and saves a new version of the file being worked on into a folder on my desktop. I love the macro with the exception of one part: I don't want to be prompted to overwrite the file if it already exists. How can I change this macro so that, when pressed, it overwrites the file without prompting the user and waiting for their answer?

Here is the current

Sub SaveIt() ...

View 3 Replies View Related

Open File Macro, Error - Incrementing File Name

Feb 2, 2007

When it opens the desired file, it increments the file name by 1 each time it is opened (via the macro).

Example;
The first time it is opened you see the file name in the header read "P'Binder L&T Pages" for a moment, then it changes to "P'Binder L&T Pages1"...
I close the file and open it again (via the macro), and see the file name in the header read "P'Binder L&T Pages" for a moment, then it changes to "P'Binder L&T Pages2"...
The file name continues to increment on every opening until the PC is rebooted, then it starts at 1 again.

Sub OpnLTpages()

Dim wb As Workbook
Dim AlreadyOpen As Boolean

AlreadyOpen = False

For Each wb In Workbooks 'Scan open workbooks
If wb.Name = "P'Binder L&T Pages.xls" Then ........................

View 9 Replies View Related

Sort Multiple File Data & Copy Matching Records To New File

Feb 13, 2008

This is a sample of the data with which I am working. I know that a macro can do what I need, but I am only versed in Excel formulas and not that much programming. I need to be able to first sort the data by Column C ("Element Type"), then by Columns E, F, G ("Year", "Month", "Day"). Then, I need to be able to copy all rows that have the same "Element Type" and "Year" to a new file, using the same header from the original spreadsheet on each new spreadsheet - doing this multiple times until the end of the file is reached.

Ideally, the new files would have a strict naming convention: XXXXXX-ZZZZ (YYYY).xls, where the X's are the value of the "COOP Station ID" in Column A, the Z's are the "Element Type" from Column C, and the Y's are the "Year" from Column E. If this theoretical macro were run with the Sample Data file I provided, it should result in the creation of five new workbooks. Is there a way to write a macro to do this, or at least something similar

View 3 Replies View Related

Open A Closed File To Archive Some Data From A Current File.

Oct 20, 2009

I have the need to be able to open a closed file to archive some data from a
current file.

what coding i need to be able to kick the "open file" bit off?

View 4 Replies View Related

Copy Data From New Everyday Csv File To Next Empty Row In Master File

Dec 15, 2009

I have csv files auto generated (with date stamp in name) and saved in a specific folder everyday. I need to find a macro that will copy the row(s) every day and add to the next empty row in the master excel file. Some days the csv file may have a single row of data and on some other days it may have multiple rows of data to copy and paste.

View 4 Replies View Related

Moving Columns Of Data Into Another File And Saving File With New Filename?

Aug 30, 2013

I was wondering if there is a way to write a macro that will take an excel file that I have called Alldata and then have it copy the first two sheets to a new workbook named something else( FullSparameter_0) and then copy the name of the third and fourth sheet into the new FullSparameter_0 workbook and then copy column A-E from sheet dB Alldata.xls and paste it into the FullSparameter_0.xls workbook in the same dB sheet in the same spot. And do the same thing with the Phase Sheet. i know this sounds confusing, but im really new to the VBA stuff.

I just need 15 different files from the original Alldata.xls that will be named FullSparameter_0, FullSparameter_1, .., FullSparameter_14. but each file will have the same two first sheets, Setup Information and Cal Verification, and the same last two sheet names, dB and Phase, but then in the dB and phase sheets, it will copy over the next four columns of data. so in FullSparameter_0 it will have column A-E from sheet dB in Alldata.xls in the dB sheet in FullSparameter_0 (Same with the Phase Sheets). Then in FullSparameter_1 it will have column A and Columns F,G,H and I (for dB and Phase). In fullSparameter_2 it will have column A and then J,K,L and M. Each FullSparameter_X will have the exact same first two sheets and then the other columns for the last two sheets will be pasted into columns A-E in dB and Phase.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved