Concatinating Data From Two Workbooks (Macro)

Apr 10, 2008

I need a macro which will join information contained in two workbooks

The way I want to do this is to open a MASTER WORKBOOK (sHEET1) enter the two filenames in Cells D6 and D7 e.g Ted1.xls and Ted2.xls.

The file path would need to be entered into Cell D5 e.g s:dataspreadsheets

The filename for the concatinated sheet should be entered into Cell D8
e.g TedsConcatinated.xls (the save file path will always be as per Cell D5)

I need to open the file in D6 change to worksheet CopySheet Copy the contents of cells B2 to G48 past the contents into the mastersheet starting at cell C10

Open the file in D7 change to worksheet CopySheet Copy the contents of cells B2 to G48
past the contents into the mastersheet starting at cell C57

Save the sheet with the filename in D8

I need to do a few other things as well but this will be very good for starters.

View 9 Replies


ADVERTISEMENT

Macro To Extract Data From 3 Workbooks With Execptions

Feb 23, 2010

I’m not to sure this can be done but I will try and explain what I would like. I have a Master workbook simply called Master.xls (Price) and I need to extract data from 3 other workbooks, these workbooks are in a folder called INFO, the workbooks are called, Summary.xls,(Sheet1) Supplier.xls (Sheet1) and List.xls.(Sheet1). I have attached sample files of all the workbooks, the original Summary has about 2000 colums and the original List.xls has about 20000 columns.

The only workbook i would like to open would be the Master.xls, would it be possible to exract the data without opening the other workbooks? or at least to look like they are not opened. On the Master.xls

When the data button is clicked I would like the following info displayed, if possible. A3 info comes from looking at Summary.xls columns B & C and comparing it against List.xls columns A & B, when a match is found in either of the columns, the code in List.xls C column will be displayed in the Master.xls A3 cell
...........

View 4 Replies View Related

Macro To Copy Data From Open Workbooks

Feb 12, 2009

I'm just starting out on my journey into VBA and this forum has been a valuable resource for picking up hints and tricks

I've decided to cut some corners and ask for help for the final piece of my current jigsaw - effectively this comes in two bits.

Part one:

I want to copy a sheet from two open workbooks and paste them into my active wookbook. Both source workbooks only have one sheet. I want a dialogue box to select the desired workbook, select and copy all data and then paste to a specified sheet (replacing the current data) in the destination workbook. I then want to select the other source workbook from the dialogue box and copy all data to a separate sheet in the destination workbook. I would like the dialogue box to have two options - Ok to select, copy and paste data, Cancel to end the macro.

Part two:

I want to copy a sheet from my source workbook and paste it as a separate sheet in a new workbook (a one page workbook would be ideal). I then want to save the new workbook in a specified location as "Data - Date" in the format 2009 02 12.

View 9 Replies View Related

Macro Combines Data From Several Workbooks Into One Workbook

Apr 19, 2006

I have several individual excel workbooks all in one folder that I need to do some analysis on, but in order to that i need to have them all in one workbook. all of the files are saved in the same folder on my shared drive. each record from each of the files needs to be transfered over into this blank template that i have. I used the Blank template to create all of the individual files, Now i just need to get them all into one file that is easier to work with

View 9 Replies View Related

Macro To Copy Data From Two Workbook To Another Where All Workbooks Are Open

Jun 7, 2014

I have 3 workbooks open. 1 is my working file and I name it as "Final[date].xlsm". The other 2 files are my source files which are also open are named as source1.xlsx and source2.xlsx. Both the source files has only one tab/sheet as "Sheet1". My objective is to bring the contents of the source file to my working file in 2 different sheets. all the contents in Sheet1 of "Source1.xlsx" should be paste.values only to the "Final[date].xlsm" with a sheet name "BankDetails". This will enable the user also to replace the old data in "BankDetails" tab. The "source2.xlsx" sheet1 has a different situation. I need to copy only the cells with values, not the entire cells, because it has to be pasted (values only) to range C2:L. I have formulas in the other columns before C and after L.

Take note that my working file name is changing every based on the date while my source file has always same file name.

View 12 Replies View Related

Macro To Create Multiple Workbooks Based On Data

Jul 31, 2013

I have a worksheet with the following columns:

Brand
UserName
FirstName
LastName
Email

[Code]....

This is a relatively long list - 1000's. What I'd like to do is create a macro that sorts by brand, and at every change in Brand, copy the user details (Username, firstname, lastname, email) to another workbook with those labels at the top of the table. Upon completion, it saves the workbook with the name of the appropriate brand.

E.g. I'd have 3 workbooks:
- BrandA.xlsx - with the 2 user listed
- BrandB.xlsx - with the 1 user listed
- BrandC.xlsx - with the 1 user listed

View 3 Replies View Related

VBA Macro To Pull Data From 3 Closed Workbooks And Filter

Dec 13, 2013

What I want to do is pull data from columns A,B,C,D in 3 other closed workbooks (export.csv, export1.csv, & export2.csv) to my main workbook (Thunder.xlsm)and append that data in columns A-D on my main workbook. In addition I created a list of 10 names (but need to expand or delete from this list as personnel change) in Column O that I would like to filter the data in A-D. The names in the list must find the data I want to keep in column D, the rest I want to delete (not the entire row, just A-D for that particular row that does not match the criteria in column O, and shift those cells up).

I've attached a sample spreadsheet that will clarify what I am asking. I'm preferably asking for 2 macro's, one for the pull of data, and the other for the filtering.

Column A
Column B
Column C
Column D

[Code]....

View 1 Replies View Related

Macro Copy Data From Multiple Workbooks Into Master Workbook

Aug 4, 2012

I have 17 workbooks which contain similar data and formatting. The only variance is the number of rows of data in each. I want to write a macro in the Master worksheet that will accomplish the following

1. Create a worksheet name in the master workbook with the same name as the workbook that it's pulling data from.
2. Copy over the column headings from columns A:P to the newly created worksheet on the master workbook
3. Copy over all rows that contain the word "down" under column D titled Operational status

The naming convention for the master workbook will be titled "All Switches". The naming convention for the worksheets containing the data are titled Port_Map_on_tiegcsw01, Port_Map_on_tiegcsw02, Port_Map_on_nypgcsw01. There are other names , but I can reference the code an update accordingly.

I found some searches on the forum for creating a macro to copy data between workbooks, but not quite sure how to write the macro for the three functions.

View 2 Replies View Related

Macro- Code To Transfer Data From Multiple Workbooks Within Folders

Sep 15, 2008

I have been given the following code to transfer data from multiple workbooks within folders and subfolders to retreive the same line of data from each of the workbooks and place them in a master workbook.

the folders are set up as follows,

there is a main folder, (a yearly folder)
within this are 12 monthly folders (named January to December)
within these are four weekly folders (named week 1 -week 4)
contained within these weekly folders are the workbooks that i wish to copy data from.

for example a1 - k1

the code i am using transfers the file names but comes up with #REF! instead of transfering the data

Here is the

View 9 Replies View Related

Macro Close Workbooks - Large Amount Of Data On Clipboard Msg

Mar 8, 2005

I am using the close.workbook command in VBA to close a workbook I opened to copy data from. I am getting a message that says "You have a large amount of data on the clipboard. Do you want it available?" What command do I use in VBA say no to this message?

View 5 Replies View Related

Macro Or Userform For Extract Data From Multiple Workbooks By Giving Date Range

Apr 2, 2014

I jst need to console data from different workbooks to one worksheet. There are 30 workbooks & each workbook contains one worksheet name as Data. The work i am currently doing mentioned below step wise

1) Open workbook
2) Apply filter on whole data
3) Select dates from "J" Column (E.g 02/10/2014 to 02/20/2014)
4) Then Copy whole filtered data
5)Paste into New workbook
6) Open another worbook
7) repeate Step # 2,3
8)Then paste whole data in below the first data New Workbook (In which we have paste the first data below that i will paste this data)

These steps i have to do manually it takes almost 1hr daily After pasting all 30 workbooks data in one workbook i have to make pivot of it & sent it to my Manager. What i need

I jst want a excel macro that will ask me date range from which i have to pull data from all 30 workbooks.

Once i gave date range will jst click on button say extract or pull. It willl console whole 30 workbooks data from the given date range in a one worksheet.

View 13 Replies View Related

Macro That Takes Workbooks Or Files And Runs Them Through Another Macro

Apr 25, 2007

i need to make a macro that takes workbooks or files and
runs them through another macro. i already have the 2nd macro
done and it is working perfectly i just need to know how to make the one
that finds the other files and runs them all through the macro i already made. My boss said that he will have about 150-200 files to run through this macro.

View 9 Replies View Related

Merge Data From Multiple Workbooks Stacking Data Into Master Workbook

Aug 2, 2013

I have three source workbooks that needed to be consolidated into a master workbook pasting the data with values & formatting.

The Master workbook also contains 6 additional worksheets that link to the data pulled in from the source files.
My question is how do I write the code so the source files populate the master in a specific order.
For example, the 3 source files are named "Central" "NED" and "WEST" and I need them to populate the master workbook in that order.

This is the code I am using to consolidate the data:

Option Explicit
Sub ConsolidateSheetsFromWorkbooks()
'Author: Jennifer Starr
'Date: 7/12/2013
'Summary: Open all files in a folder and merge data (stacked) on all

[Code] .....

View 1 Replies View Related

Macro Available To All Workbooks

Nov 30, 2007

I would like to create a module for spreadsheet and I want it to be included in all excel files, i.e. whenever you open any excel file that vba module should be included

View 4 Replies View Related

Macro Not Working For Other Workbooks

Jan 28, 2014

Below is a code which I added to my 'Quick access toolbar' (and which is based off a hidden workbook). I use this macro to fulfill tasks to regular excel spreadsheets that are not macro enabled, however, I can't seem to get this macro to work for other workbooks. How to modify my code to work for other spreadsheets.

[Code] .....

View 4 Replies View Related

Running Macro In Different Workbooks

Mar 25, 2014

I have 7 different workbooks as part of my daily routine.

At present the first workbook is opened via the task scheduler, and the macro is run using the following code

[Code] .....

This then opens the next workbook and closes the current one. The next workbook then runs its macro again from a timed call

[Code] ...........

This repeats for 7 workbooks. The problem is, if a macro overruns - the whole schedule is out of sync when macro's are called depending on the time. What I would like to do, is link each macro by calling for the next one, and closing the current workbook. However, when i have tried to do this, the macro has always stopped when the workbook has been closed - the next macro doesn't run.

View 2 Replies View Related

Macro To Consolidate Workbooks?

Nov 13, 2013

I need to create a macro that pull in data from various spreadsheets, all with the same layouts, but with different file names and different worksheet names, into on master worksheet. The data should drop in after the title line and then continue on after each data set has copied.

View 3 Replies View Related

Macro To Work Across Many Workbooks?

Apr 17, 2007

I need to remove hyperlinks across probably 30-40 workbooks, is there a way of doing creating a macro that would do this across many instead of 1 at a time?

View 9 Replies View Related

Apply Macro To All Workbooks

Aug 10, 2008

Could somebody update the below code so that it actions all open workbooks except the master (Book2). Also, so that it appends the data (which is basically 2 neighbouring colums of data) to the Master starting in column A

Sub Format_RAW()
'
' Format_RAW Macro
'
' Keyboard Shortcut: Ctrl+s
'
Selection.AutoFilter
ActiveSheet.Range("$A$1:$P$5105").AutoFilter Field:=7, Criteria1:=Array( _
"H1", "H2", "H3", "H4"), Operator:=xlFilterValues
ActiveSheet.Range("$A$1:$P$5105").AutoFilter Field:=1, Criteria1:= _
"Tu"
Range("G7:H7").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Windows("Book2").Activate
ActiveSheet.Paste
End Sub

View 9 Replies View Related

Macro That Updates Other Workbooks

Sep 25, 2008

I have a macro that I use to keep other worksheets updated with current codes and whatnot. The macro opens each workbook in the directory and updates the worksheets. It works fine except that it's only updating 1 sheet within the workbook (whatever sheet is active). I need help actually cycling through ALL the sheets in the workbook. There are 7 worksheets in each workbook. The code I need help with is in red.

'=====================================================
'CODE BELOW IS USED TO UPDATE INSTRUCTIONS SHEETS.
'=====================================================
Dim FromBook As String
Dim ToBook As String
Dim ToSheet As Worksheet
Dim SPDir As String

Sub Update_Columns()

Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlCalculationManual

SPDir = "m:SPDWA"
FromBook = ActiveWorkbook.Name

'-Code to loop through files in directory.
'On Error Resume Next
ToBook = Dir(SPDir & "*.xls")
While ToBook ""
If ToBook FromBook Then
Application.StatusBar = ToBook
Update_Data ' subroutine below
End If
ToBook = Dir
Wend
'-- close
Range("A1").Select
MsgBox ("Sheets Updated.")
Application.StatusBar = False
Application.Calculation = xlCalculationAutomatic

End Sub
'=====================================================
'SUBROUTINE TO LOOP THROUGH FILES AND COPY CODES.
'=====================================================
Private Sub Update_Data()
Workbooks.Open (SPDir & ToBook)
For Each ToSheet In Workbooks(ToBook).Worksheets
ActiveSheet.Unprotect "Password"
Update_Column_Fields 'Subroutine to copy codes (not shown here)
ActiveSheet.Protect "Password"
Next
Workbooks(ToBook).Close savechanges:=True
End Sub

View 9 Replies View Related

New Workbooks To Get A Worksheet_change Macro

Oct 2, 2009

Rather than just export and import a module, to import a sheet macro?

I don't quite know what they're called, but basically I have a functional Worksheet_change macro, which is sitting idly in a module. When a separate macro is run which creates new workbooks, It exports that specific module to the desktop, and then the new workbooks all import the module. THat works fine.

But I want all of the new workbooks to get a worksheet_change macro (so a macro that goes into the sheet, not into a module in the workbook)

View 9 Replies View Related

Macro On Shared Workbooks

Mar 1, 2007

I've set up a macro to run in the workbook open event, to open a user form that restricts user access to the spreadsheet. This works fine, but I need to make the spreadsheet shared and when I open it the macro doesn't run. it's still possible to use the workbook_open event on shared workbooks or if not suggest an alternative method of running the macro on opening.

View 2 Replies View Related

Running The Same Macro For Different Workbooks

May 7, 2007

I was able to create a macro that formats the worksheet that I am working on. However, I would like this macro to be available to all worksheets that I would be downloading from a system.

I tried using the personal macro workbook, but when I ran the macro, it formats the personal worksheet and not the one that I would want to format.

I used general codes, but it pasted the formulas onto the personal.xls file.

View 4 Replies View Related

Run Macro On Multiple Workbooks

Sep 5, 2007

Ive just started using vba for excel and put together a very simple peice that uses the goalseek function. See below.

Public Sub calc_vol()
Dim currentcell As Range
Worksheets("sheet1").Activate
Set currentcell = Worksheets("sheet1").Range("bl2")
Do While Not IsEmpty(currentcell)
With Application
. Iteration = True
.MaxIterations = 100
.MaxChange = 0.00000001
Application. ScreenUpdating = False
Application.Calculation = xlCalculationManual
End With
ActiveWorkbook.PrecisionAsDisplayed = False
currentcell.GoalSeek 0, currentcell.Offset(0, -13)
Set currentcell = currentcell.Offset(1, 0)
Loop
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

The code works great (a little slow - but fine for 65,000 lines), however i have nearly 100 workbooks that i have to run this macro for. I was wondering if anyone knew how i could manipulate it so that i could incorporate all 100 files into the macro, therefore running the macro once for all 100 files. If this is not possible is it possible to link multiple worksheets.

View 2 Replies View Related

Compare Data In 2 Workbooks And List Missing Data

Mar 13, 2007

I have data in 2 workbooks. Book1 - Sheet1 - Col A and Book2 - Sheet2 - Col A. I want to compare Book2 with Book1 and list all values in Book2 that do not find a match in Book1. I want to run a macro for this

View 7 Replies View Related

Opening Workbooks From Macro In Toolbar?

Mar 13, 2013

What I'm trying to achieve.I'm trying to create a toolbar to have visible in excel which provides me with shortcuts to a selection of functions and some other useful documents.

I've created a document "Toobar 1.xls" in column B of which I have the file locations of the documents I want to open, the documents are moved from time to time and it is easier for other users to update the spreadsheet than vb.As you can see below I've written a piece of code to open up a document, I've created a function because there are a few documents I want to create links to and thought it would be cleaner to do it like this. This code is stored in "Module1" of "Toolbar 1.xls".

I've then created a new toolbar in excel and added a custom menu item and allocated it the macro "Pension_Credit_Calc".

When I run the code from within "Toolbar1.xls" it works fine, however if I try to run it from another workbook I get "run time error 1004". I suspect it's probably something to do with where I've stored my code,

PS. The reason I have not simply created a shortcut in the quicklaunch bar is that I will also be altering the workbooks once opened.

Code.

VB:
Function OpenUp(FileLocation) As String
Workbooks.Open (FileLocation)
End Function [code]....

View 2 Replies View Related

Macro Cycle Through Open Workbooks

Mar 29, 2013

I am trying to cycle ALL open workbooks so that I can choose the file to manipulate in subsequent code this is the code that I am utilizing furhter below

this is my code

VB:

For Each wb In Workbooks
If MsgBox("Do you want to do access this Workbook for the Update " & Chr(10) & Chr(10) & wb.Name, vbYesNo) = vbYes Then
wb.Activate
VI_wb = wb.Name
I = True
End If
Next wb

But for some reason it only loops through .xls and xlm workbooks BUT not .xlsx

is there a way that I can loop through any and all open workbooks.

The reason I do this is because my update are based on many numerous excel workbooks with differnet extentions, and naming conventions and many of the come via email, I cannot use the eact naming convention

View 1 Replies View Related

Macro - 10 Workbooks Into 1 Workbook With 10 Sheets

Jan 24, 2014

I'd like to create a macro that will take 10 workbooks and add them to a new work book, but have each workbook as a separate sheet.

So every month from work I get a report file labeled as the current month (JAN_14). Then there about 19 folders in that folders labeled with product names; then in those folders are two excel files (they're all named MSTASCH_QUICKLOOK_1 and MSTASCH_QUICKLOOK). I figure if I can see the macro to combine 10 workbooks I can change it to do less or more workbooks. I had tried a macro that takes the workbooks from one file and puts them into two seperate sheets (although I would love to have the order changed of how they're put into the workbook).

VB:
Sub MergeSheets()
Dim wbDst As Workbook
Dim wbSrc As Workbook

[Code]....

View 4 Replies View Related

Running One Macro For Multiple Workbooks?

Apr 7, 2014

I have approximately 30 workbooks for which i open and run a macro to change the look and feel for client perusal.

I normally open each of the 30 workbooks and run the macro for each one.

Is there a way I can run the macro to apply to all workbooks at once?

View 3 Replies View Related

VBA Code To Run Macro In All Open Workbooks

Mar 12, 2014

I have a macro to get copy of sheet named "Doc Info" from workbook File 1 to active workbook.

I could do it for one file on any active workbook.

But what I would require is, upon executing this macro , i want this macro to get executed in all open workbooks( could be any numbers ).

I want to move copy of sheet from File 1 to all open workbooks ( which i am doing it manualy for every file )

All these open workbooks could be from any folder , wont be in same folder.

So logic is to execute my macro apply in all open workbooks in my computer.

Below is the code and i have attached file for test

HTML Code: 

Sub Copysheet()
Dim wSht As Worksheet
Dim wBk As Workbook
Dim wBk1 As Workbook

Set wBk = ActiveWorkbook 'Workbooks("File 2.xls")
Set wBk1 = Workbooks("File 1.xlsm")
Set wSht = wBk1.Sheets("Doc Info")

wSht.Copy before:=wBk.Sheets(1)

End Sub

View 2 Replies View Related







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