Macro To Create A Copy Of Current Workbook

Mar 12, 2014

I have a workbook with Macros in it, now I want to create a copy of that workbook using VBA.

Here are the steps i want:
1. Create a copy of an open workbook
2. Open the Copy.
3. Close the original workbook.

View 1 Replies


ADVERTISEMENT

Macro To Copy Current Sheet, Create, & Rename New Sheet From Current Open Sheet

Oct 27, 2008

EXAMPLE: Complete Sheet called "Day1". When day1 is complete you click on button and it then copies itself and creates and renames new sheet to "Day2", then when "Day2" is complete you click on button and it then copies itself and creates and renames new sheet to "Day3", and so on and so forth to "Day30".

View 9 Replies View Related

Copy Worksheet From Closed Workbook To Current Opened Workbook

Aug 21, 2014

I have an open workbook (A) and this is where the code should reside. I want to use VBA to copy the content of an entire worksheet from a closed workbook (B) to an existing worksheet in workbook A. How would you accomplish this?

View 7 Replies View Related

Search Cell Value In Another Workbook And Copy Range From Current To Other Workbook

Mar 11, 2014

I have 2 workbooks. 1 is where data is entered called wksPB, the other is like a database workbook. The wksPB has data to be feed from column B to F and there is a dropdown.

what im looking to do is, if the combobox value is selected as Decline then it should display a messagebox that reference value in cell B is denied. if combobox value is Agreed then the macro should search the database workbook for the text entered in column b of wksPB and then copy data of C:E of wksPB to H:J of database sheet where that text is found and also the approver name in wksPB C24 to the approver cell of where that text was found. I've reached till finding the text but what I get my head twiting on is how to copy the text from wksPB column B:F to database sheet column H:K. Im attaching the sample workbooks and the code where ive reached till.

[Code] .....

Attached Files
Replacement Records - 2014.xlsx‎
forum file.xlsm‎

View 1 Replies View Related

Autofilter Another Workbook And Copy Range Into Current Workbook

Mar 2, 2014

I'll soon have an ETL process that will load about 150K rows into an Excel workbook. On of the columns will be the end user's userid.

I need to autofilter that external workbook based on the end user's userid, copy that range, clear a worksheet on the current workbook, and copy that range to the current worksheet.

For example, see the attached workbooks. I need to replace the data in Source.xlsb!Cases with the data in Output.xlsb!Case_List, filtered on my userid, which we'll call foo.

View 1 Replies View Related

Copy Worksheets Into Current Workbook

Oct 30, 2006

I have developed a macro, run by a button click, in my workbook.

I have about 5 other workbooks to process, what I want to do is to have my workbook with my macro open, then either copy or import these other 5 workbooks, one at a time, into my current workbook so I can run my macro on their data. Not sure if I need to copy them in or not, but thats all I can think of. I'm not even sure how to do this manually, I tried having my workbook open and doing a file - import on the .xls file, but it seems to be translating my data and I'm ending up with a value of 'f1' in one of my columns, no idea what that is. All I really want to accomplish is to run my macro on each of the 5 workbooks, one at a time.

View 4 Replies View Related

Copy Current (Selected) Sheet To New Workbook And Save As Tab Name

Feb 28, 2014

I want to take the current sheet and copy to a new workbook (keeping the tab name) and then save as the tab name (xlsl) and close.

I've found ones that do a Saveas box or ends up saving as "Sheet1," "Sheet2" etc but can't seem to find one that keeps tab name and saves.

Here is the one I was using, but it saves all tabs not just selected:

Code:
Sub CopySheet()
Dim fname As Variant, ws As Worksheet, wb As Workbook
Dim nCol As Integer, iCol As Integer

[Code].....

View 1 Replies View Related

Copy Data From Open File To Current Active Workbook

May 2, 2008

I want to create a standard macro that will copy values from a Master workbook to the current, active workbook I have open. The problem I have run into is when I record a macro it also records the name of the active workbook I'm copying data into and I would like it so when I bring up a workbook I just run the macro and it copies the values in. I'll be doing 8 different macros that each copy different values from the Master spreadsheet

View 8 Replies View Related

Get Pivot Table Macro To Refer To Current Workbook?

May 16, 2011

I have to excel files, both have the same data. I created a pivot table macro on the first file. I want to be able to open the second file and use the shortcut to create the pivot table. the problem is that it refers back to the original workbook I created the macro on. How do I change the code to make it refer to the current workbook?

Code:
Sub Pivot()
'
' Pivot Macro

[Code]....

View 1 Replies View Related

Macro That Saves Current Open Workbook To Directory Specified?

Jan 10, 2012

I would like a macro that saves the current open workbook to a directory specified in a cell on the open work sheet.

View 4 Replies View Related

Copy From Closed Workbook Then Create New Workbook

Jan 31, 2007

I've got a problem with this code, have been wracking my brains about. Here is the process I am trying to do:

1) Copy a range (a2:av1000) but (ideally) find the last populated row from a closed workbook (with a different password)
2) Create a new workbook and paste this data into it at A2
3) Close all the workbooks but only save the new one.

View 9 Replies View Related

Create Macro That Can Create Dynamic Copy / Paste Loop?

Feb 12, 2014

I need to create a macro that can create a dynamic copy/paste loop. So far what I have is horribly inefficient. Each row in colmn A(minus the header) has a unique number in it. For each unique number, I need to paste it based on the number of column headers in row 1(minus column A). So, if there are 20 column headers, I need to copy cell A2 and paste it 19 times in another sheet. Then, I need to move to the next number in column A and do the same thing. Here's what I have:

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

You can see that this is not dynamic. If I add another row to my table and rerun the macro, it will not catch it. I've attached a sample file to show you the big picture of what I'm trying to do. The data that I have is in Sheet1, and I'm trying to get it into the format in Sheet3. Rows/columns will be periodically added to the table in Sheet1, so the macro needs to be dynamic to catch that. The data in Sheet3 will always remain, and the macro will add the updated data below the old data in Sheet3.

FC_Macro_Sample.xlsm

View 8 Replies View Related

Macro To Create New Workbook And Sheets Inside Each Workbook

Mar 31, 2009

I have a spreadsheet which has all the names of trips from a warehouse, the day that they operate (1,2,3 etc) and the job line allocated to each trip. It looks something like that:

A B C
DAYTRIPCUST

I would like to create a macro that will be creating 7 new workbooks and then in those workbooks as many sheets as the trips. In these sheets, the customers should be displayed.

How do I write it? I could not find how to have a "dynamic choice" in the macro. I.e. not to have the criteria as "1", "trips1" but to choose from the range of inputs that are available.

View 9 Replies View Related

Copy Range :: And Create New Workbook

Oct 19, 2009

I have a currently working macro to copy the current sheet as values and create a new workbook in the same folder destination. That code is as follows:

View 10 Replies View Related

Create Workbook & Copy Paste To It

Nov 20, 2006

I am currentyly using VB to extract some data sets to another tab in the same workbook. I would like to extract the same data to a new workbook that is already created upon running a macro. How do I specify the location of the new workbook and sheets so the code will extract and input correctly?

The code I am currently using is:

Sub RunModel()

Dim Events As Range
'
'
Application. ScreenUpdating = False

Set Events = Worksheets("Inputs").Range("L41:L90")
Worksheets("Results").Range("A5:FX5004").Clear
Worksheets("Results").Range("A5009:FX10010").Clear

y = -100

For x = 1 To 50

View 3 Replies View Related

Create Macro That Filter Date In A Column From One Week Previous Till Current Date

Mar 14, 2014

I have an excel sheet wherin there is a column that has the data where in the dates are displayed and many other columns.

I get this excel every Thursday so i want to filter this date column in such a way that it give me the data related to the date of the previous week only yet there is a catch here. When i say previous week i mean.

Suppose today is 03/14/14 then i want the data from 03/07/14 till today ie Last week friday to this week full( so cant use Current week option) and then paste it in a new sheet.

I tried the Record part but in that it is taking a hard coded value as i am selecting the date myself. I dont want to change the date manually every time.

this was the macro that was created

Code:
ActiveSheet.Range("$A$1:$BX$58").AutoFilter Field:=1, Operator:= _
xlFilterValues, Criteria2:=Array(1, "3/10/2014")
Range("A59").Select
ActiveCell.FormulaR1C1 = "=COUNT(R[-4]C:R[-1]C)"
Range("A60").Select

View 8 Replies View Related

How To Create Copy Of Excel Workbook In Same Directory

Mar 20, 2014

I have Workbook named"Test_Template" in below specified path this is not the active workbook.

It is saved in strFName = ThisWorkbook.Path & "Backup" & "Test_Template.xlsx"

I need to create a copy of the same workbook named as "Copy_Test_Template.xlsx" in the same folder(Backup), same specified path on button click.

[Code] .....

But this creates a "Copy_Test_Template.xlsx outside the Backup folder, i want it in the back up folder.

View 2 Replies View Related

Create Copy Of Workbook Without Closing Original

Dec 3, 2007

I would like to create a copy of an open workbook.

Workbook.SaveAs would seem to be a possibility, but this closes the original workbook - I need to keep the original workbook open as well as the workbook it has been "SavedAs".

I do not want to close the first workbook and repoen it as there are instances where it may be protected and I do not want the user to have to reinput any passwords etc.

View 9 Replies View Related

Named Range: Create Copy From Another Workbook

May 28, 2008

I have a named range within a sheet. It was pulled across when i performed a move/copy - create copy from another workbook. The name contains characters that cannot be displayed or recognised and so they are displayed as square
symbols. This causes me an issue as i cannot delete the name. Even if i paste the list names, i cannot copy/paste the name as the characters are not recognised. I also tried using a macro to delete all names, which did delete all names, with the exception of this one.
The VB code used was :

Sub Del_Names()

Dim myname As Name

For Each myname In ActiveWorkbook.Names

myname.Delete

Next myname

End Sub

View 9 Replies View Related

Excel 2013 :: Create New Workbook And Copy Sheet To It

Feb 13, 2014

I was given a spread sheet that prepares a file for export to some ones system. The macro in the spread sheet wouldn't run as I'm using excel 2013 which when you open a new work book it only opens sheet 1 and there was a bit in the macro that wanted to send information to sheet 2 which wasn't there. I added a bit of code which created sheet 2 and hey presto it worked fine. I made the mistake of telling the people who supplied the original workbook to me what I had done so that they could pass the modified sheet on to other users in case they had the same problem.

Now I've been asked if I could do a bit more work to the existing macro so that instead of the new workbook just being called Book 1 could I add a name and date to the new workbook being created.

I've had a look at the original code and it looks like it would be quicker to start from scratch as I cant follow the original code.

The existing workbook has 3 sheets, I want to copy sheet2 to the new workbook. I want to name the new workbook as "a fixed name" with the "time and date " .xlsx

View 9 Replies View Related

Create Copy Workbook With Cell Referencing To Original?

Apr 15, 2014

At my work we are using Excel as a CMS to produce SQL scripts for insertion into a database. The data is then turned into mobile web pages. This involves multiple workbooks - 1 for each main page with the sub-pages as extra worksheets in the book.

Much of the data is duplicated so we have created master workbooks then copied them and laboriously referenced the relevant cells back to the original. That way if any data in the master is changed, all copies will change simultaneously.

This is obviously not the most efficient way of publishing web pages but we are stuck with it for now. So I am wondering if it is possible to write a VBA code to create a copy of the master and then reference all required tables in the worksheets automatically? The tables are all named ranges.

View 9 Replies View Related

Create New Macro In New Workbook With VBA

Apr 30, 2013

Is it possible to create a new workbook, add a macro to it, set it to run as an auto open event and then save and close the new workbook?

To explain a little better, I have a macro in a workbook. This workbook is opened by Filemaker which triggers the macro to run. The macro creates a number of different workbooks using information from an online file dump which is then imported into Filemaker.

However when the import is finished, I'd love for all the files that have been created to get deleted again. Now I realise I could just create a second workbook that Filemaker opens once the import is finished that deletes all the files. However I want to keep things as simple as possible for the user, and for them to have as few files as possible so things are less likely to get misplaced in the future. My concern is as they never see the workbook macro firing, they won't realise how important it is, even if I make it very clear.

So what I was thinking is at the end of the first macro, it creates another workbook, with an auto open event macro in it that simply calls a macro from the original workbook, and once created it is saved and closed. When Filemaker is finished with it's import, it could then open the new workbook which calls the macro in the original workbook. I could then have the original workbook macro delete all the added files, and close and delete the other macro enabled workbook it created. Which would leave me with the original workbook only.

View 3 Replies View Related

Create Macro That Can Be Used In Any Workbook?

Jun 11, 2014

I would like to create a macro (with button) that can be used in any workbook. I tried creating a macro in a blank workbook and added a macro button to the Quick Access toolbar. It shows up in any workbook I have open BUT when I run the macro, it also opens up the blank workbook.

View 1 Replies View Related

Macro: Create A New Workbook

Feb 17, 2010

I've created what I thought was going to be a simple macro which will create a new workbook, rename it "Applications Calls", then copy a pivot table/report from another workbook and paste it. Here's my rather amateur code which doesn't work.

Sub copyreport()
Workbooks.Add
ActiveWorkbook.Name = "Top Ten Apps Calls.xls"
Windows("Applications Calls Logged North.xlsm").Activate
Sheets("Calls Logged by Customer").Select
Cells.Select
Selection.Copy
Windows("Top Ten Apps Calls").Activate
Cells.Select
ActiveSheet.Paste
Range("A16").Select
ActiveSheet.PivotTables("PivotTable5").PivotSelect "Silo", xlButton, True
ActiveWindow.DisplayGridlines = False
ActiveWorkbook.ShowPivotTableFieldList = False
Range("A16").Select
End Sub

View 9 Replies View Related

Create Macro That Won't Allow Movement With Workbook Until Macro Run

Jan 28, 2014

Writing a Marco. I would like to place a macro on the opening page of a workbook and like to a button that executes three functions.

1) I need to hide selected tabs in a workbook
2) I need to copy paste values of a couple select cells in a workbook
3) Lastly, I would like to set up the workbook so that the use can not move beyond the opening tab with out clicking the macro to preform the steps above.

Is this possible? I know 1 and 2 are for sure, what about 3?

View 1 Replies View Related

Macro To Create New Workbook With Name Other Than Book1?

Oct 28, 2008

I'm tryign to create a macro which will copy certain worksheets into a new workbook (i.e. Book1), and the macro continues to work with this Book1. Is it possible to create a more robust macro which will rename Book1 into something usable (i.e. "Report")? because if the session of Excel has already had another worksheet, it will go to Book2, and then the macro won't work.

View 5 Replies View Related

Macro Will Not Create New Worksheet And Workbook

Oct 28, 2009

Im trying to create a document that creates a new workbook when certain functions are selected and have written a macro to assist with this. Basically im working on a comprehensive checklist with all possible scenarios that will need to be tailored for use, so you can create a document with just what is applicable to you and not the whole checklist. I have attached a sample of what i mean, along with clearer descriptors of what the document is designed to do.

View 5 Replies View Related

Create Workbook With Macro Code Within

Jan 11, 2007

Right now I use a VBA-Code to create new worksheets in a workbook. my Question:
is it possible to attach code to the newly created Worksheet via vba-code??

View 3 Replies View Related

Modify Existing Macro To Copy To Different Workbook Instead Of Open Workbook?

Dec 7, 2012

Here's my macro:

Code:
Sub CopyRow()'
'Copies row to new sheet, highlights it, marks column 'A' as copied.
'
Dim cCell As Range
Set cCell = Selection.Cells(1, 1)
Selection.Copy
Sheets("Sheet2").Select
Rows("2:2").Select

[Code] .....

Is it possible to modify it to paste into a different workbook called c:filesDestination.xlsm, instead of the existing workbook (Source.xlsm)? The destination sheet name is the same (Sheet2). It's OK if both workbooks are open at the same time.

View 2 Replies View Related

Create A Simple Macro To Open A Second Workbook?

Jan 31, 2014

I am trying to create a simple macro to open a second workbook if the value in a cell in the current workbook is 'x' or if 'y' do nothing.

Basically I have a simple sales ledger, one column has a yes/no for whether or not an invoice is paid if no I want to open a second workbook 'debtors' so that I can manually input the details. I'm sure this is a very simple proceedure but I can't seem to crack it.

View 2 Replies View Related







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