Macro - Generating Multiple Sheets Using A Template And Source Workbook

Mar 20, 2014

I am new to the VBA editing and I am missing some steps to get my files correctly generated and then ideally saved in PDF format in the same folder.

I have two files; one is an invoice template with the following fields:

Invoice Reference: Line 8 column D
Issue date: Line 9 column D
Client name: Line 11 column E&F
Client address: Line 12 column E&F
Product name: Line 16 column E&F
Product details: Line 18 column E&F
Production date: Line 20 column E&F
Delivery date: Line 22 column E&F
Units: Line 24 column E&F
Total Units: Line 26 column E&F
Total Invoiced: Line 30 column F

Each sheet in the "template" workbook should be named after the Invoice Reference.

Secondly I have the source file in which the data is organized as follows: (Both are in the same folder)

Invoice Reference: column A
Issue date: column B
Client name: column C
Client address: column D
Product name: F
Product details: column G
Production date: column H
Delivery date: column I
Units: column J
Total Units: column J
Total Invoiced: column E

One invoice needs to be created per line in the source workbook. I tried many times the macro recording without getting the correct outputs.

View 5 Replies


ADVERTISEMENT

Copy Template Worksheet To Multiple Worksheets And Incrementally Number Sheets In Workbook

Mar 25, 2014

I have what is probably a simple request to all the VBA experts out there, and simply want to take a template sheet in a workbook and copy it across to 100 sheets numbered/named 101 -200, and add the name of each sheet as a text reference, e.g. sheet name 101 will have a cell within the worksheet that refers to sheet 101.

I have attached a simplified spreadsheet which indicates what i'm trying to achieve.

View 7 Replies View Related

Macro To Create Sheets In New Workbook Based On Template And Evaluator?

Feb 10, 2013

I had created a base data with evaluator and performance appraisals templates which should be sent to each evaluator for filling up the forms based on templates

Next,

Macro that would i require will be

Where in my base data if i select filter of "Arun", i will performance appraisal templates in column I. Next, i have sheets individually created templates which refer column I

So, based on arun filter if i select, it should create a new workbook for arun and six individual sheets of employees reporting to him with a base data and appraisal templates similarly if i select anita in filter , it should create a new workbook for anita and six individual sheets of employees reporting to her with a base data and appraisal templates

View 9 Replies View Related

Macro To Create Multiple Sheets From Template?

Nov 10, 2011

I'm trying to create a workbook with multiple worksheets. My first sheet to be named "Main" and each additional sheet to be named in sequence after the values in the cells between B5:B98 on !Main.

Example:
B5 = "01"
B6 = "01.1"
B7 = "01.2"
B8 = "02"
B9 = "03"
etc...

I'd like to have a macro that would take a worksheet in this workbook named "Template" and make a copy for each cell between B5:B98 and name that new worksheet "c" and then the value in each of those (B5:B98) cells.

Example:
First worksheet named "Main"
Second worksheet named "c01"
Third worksheet named "c01.1"
and so on.....

View 1 Replies View Related

Excel 2013 :: Generating Master Sheet From Other Sheets Within Same Workbook

Mar 25, 2014

I have a workbook with five sheets. One sheet is the Master and then one sheet each for four organizations. Each organization will populate data for their own sheet and I want Excel to automatically populate the Master with the info from each individual sheet.

I tried using and modifying the vba from this post [URL]). My workbook varies from the original in that the first seven rows are header rows so the first cell to be edited in each sheet is A8, I have 38 columns instead of 10, and I am using Excel 2013 instead of Excel 2003.

I figured out that I needed to change the vba to look like this to start copying from the first cell (A8) and to populate the master:

This seems to work, but until the first cell (A8) is populated in the organizations' sheets, it messes up the prior row on the Master (Row 7).

I've also noticed that undo becomes unavailable when switching between sheets and also copy/cut & paste between sheets doesn't work so I can't correct the way the script messes up the format initially (this I presume is due to the Copy Destination in the vba?).

View 1 Replies View Related

Paste Template Onto Multiple Sheets

Feb 14, 2008

i have created a diary using multiple tabs. I would now like to create a template that i can paste into the multiple tabs. I have tried to copy and paste but the format ends up all wrong, I would also like to paste all the tabs in one go
Regards Johnt Auto Merged Post;I dont have to paste anything all i have to do is select all sheets on the first page and then design my template on that page which will show on all pages

View 2 Replies View Related

Using Macro For Multiple Sheets In Same Workbook?

Oct 18, 2013

I have a macro listed below that I would like to use on multiple sheets within the same workbook.

Sub PrintMacro1()
'
' PrintMacro1 Macro
' To change print format from landscape to protrait

[Code].....

View 4 Replies View Related

Combining Sheets Into Single Workbook - Keep The File Source Name

Feb 21, 2014

I am trying to combine sheets from various workbooks into a single file named "Combine". The goal is to have the sheets in Combine indicating their origin.

For example, with:
"File_1" having 2 sheets, "Sheet1" and "Sheet2"
"File_2" having 1 sheet, "Sheet1"
the goal is to have a file "Combine-forum" with the sheets named:
"Sheet1(File_1)", "Sheet2(File_1)", "Sheet1(File_2)"

I have grabbed pieces of code from various sources and read on the forums, but the result is different from what I want; I don't succeed to add the file name to the sheet name. Instead of the file name, the second part of the sheet name appears to be the order in which the workbook have been opened.

To be clearer, what I get is:
"Sheet1(1)", "Sheet2(1)", "Sheet1(2)"

Attachments: To_be_combined.zip 3 compressed files to be combined. I suggest to copy them in C:TEMP and to copy this path in the InputBox (see below). Combine-forum.xlsm Best working file that I have been able to create

View 2 Replies View Related

Macro Protecting Multiple Sheets In Workbook?

Sep 6, 2012

I have a large workbook with 10+ sheets i need to protect all at once. I have created a macro in VBA below. It works, but I would like another user to be able to change formatting on the sheets while they are protected. below is my macro.

Sub ProtectAll()
Dim wSheet As Worksheet
Dim Pwd As String

[Code].....

View 1 Replies View Related

Macro Add Sheets Using Template And Name Them From Column Of Cells

Feb 4, 2014

Step 1: I have data coming from a data dump which is placed on the "Summary" sheet of my excel workbook. I need to take column A (beginning at A8) and create a new sheet (based on "Template" located in the same workbook) for each name in column A.

Step 2: I need to place the name of the new sheets in cell C4 of each sheet so I can do a lookup using C4 as my lookup_value, so this can't be a formula like "=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,256)" because lookup doesn't function properly.

Step 3: Delete "Template", so that the only things left are the "Summary" sheet and the new sheets.

Each department will have their own workbook with a "summary" sheet and different sheet names although they will all start off with the same data dump and will all be in the same format. Each department could also have a different number of new sheets added depending on information from the data dump.

I found a utility (ASAP Utilities) which will do the steps I need done, but it won't record in the macro.

Budget time is fast approaching and each department needs their worksheets.

View 9 Replies View Related

Programming Macro To Operate Over Multiple Sheets Or Workbook

Aug 1, 2012

I'm trying to set up a way to format column widths and row heights in a macro (so that it can read a value from a cell and format a column to that width). I've used the code below which can be repeated for the number of rows and columns desired below

Worksheets("Sheet1").Range("d1").ColumnWidth = Range("d1")

However, I want to be able to do this on a workbook that could potentially have 40+ sheets. Is there a way of applying this code to operate over the whole workbook rather than just one sheet at a time?

View 7 Replies View Related

Macro To Copy Range From Multiple Sheets And Paste In New Workbook?

Aug 3, 2012

I have a macro that takes info/data from multiple sheets in the Basin workbook and summarizes it into the Median Database workbook. I need to copy the values in range B5:EM5 in every sheet (each sheet name is site #) in the Basin workbook and paste that range into the median database workbook row with the corresponding site.

Here is what I have so far

VB:
Sub Median_Database()
'This Macro takes the median from each station tab in the current Basin workbook
'And inserts it into the Median Database workbook

[Code]....

how to grab the sheet name and insert it in the median database. The problem is the copy/paste of the range in each sheet. The macro locks up every time.

View 2 Replies View Related

Macro To Find And Replace Values Across Multiple Sheets In Same Workbook?

May 27, 2014

I have an excel workbook with 60 sheets (each contain data in the same categories and in the same column locations, just different information on each sheet). What would the VBA code look like if I wanted to manually enter the find and replace values and perform the function (find and replace) across multiple sheets in the workbook?

View 5 Replies View Related

Excel 2007 :: VBA For Print Header For Multiple Sheets From One Source Sheet (but Not All)

Apr 18, 2013

I am working on a "3 worksheet" excel workbook. The first worksheet does not require any header.

I'd like to enter data into the second sheet (say cells A1 and B1), and use VBA to pull from those cells to generate the same custom header for both the second and third worksheets.

For example, I'd like the header to pull "# 123456" from cell A1, and "789" from B1 in sheet two, putting them in a centered header for both sheets two and three (same reference cells from sheet two for both, not new values of A1 and B1 from sheet 3 for sheet 3 header). I'd like to format in a way that looks something like this:

#123456

789

I'm currently running Excel 07, and was able to pull from a cell on one worksheet into that sheet's header but couldn't get it to span multiple sheets.

View 3 Replies View Related

VBA -Determine Last Row Of Source Data Tab For Use In Executing Formulas In Template Tab

May 7, 2008

I am currently building a workbook with 2 tabs.

The first is a data dump tab. The number of rows used in this tab will change each time it is used.

The second tab currently has a header row and in cells A2-H2 are formulas based on data in the first tab.

I am creating a macro to autofill those formulas, but I don't know how to determine what is the last row of data in the 1st tab and use that as reference in my macro.

View 9 Replies View Related

Automatically Generating Day And Date On Several Sheets

Dec 5, 2007

I have made a daily planner for each month. The dates are on separate sheets which are titled 1st Dec 07, 2nd Dec 07 and so on.

This is also included on the actual sheet as well in the form of a heading. I want to know if it's possible to automatically rename the text on the sheet to what the sheet is called?

Or if the first sheet has a title of '1st Dec 07' how can I get the other sheets to automatically be titled in sequence so I don't have to do it manually?

View 14 Replies View Related

Printing Multiple Sheets In Workbook With Hundreds Of Sheets

Feb 18, 2014

I have a work sheet named "Main_List"...In column D starting with "D2" I would like to list worksheets that I would like to have printed via VBA.

The workbook has several hundred worksheets and I would like to list in column D only worksheets that I would like to print with VBA code.

View 3 Replies View Related

Copy Data From Multiple Sheets In Workbook To Different Workbook But On One Worksheet

Feb 7, 2014

I am looking for a code that would copy the data from each worksheet in a given workbook and then paste to just one worksheet within a different workbook. The Sheet names are auto generated when I run this canned report but the naming structure is always the same...the first worksheet is named Repair Details and then the next sheet is named Repair Details_1, the next sheet is named Repair Details_2 and so on for every sheet in workbook. So I would like to copy all of the data(Headers to last cell) and then paste in a worksheet(ex: Master Repair Report.xlsx and the worksheet could be titled Master Repair Details) on a different workbook, then the next sheet would copy from the one under the header to the last record and paste to the same workbook. This process would repeat for every worksheet in the Repair Details Workbook and paste to Master Repair Details worksheet in the Master Repair Report workbook.

View 4 Replies View Related

Excel 2010 :: Counting Cells With Multiple Criteria On Multiple Sheets In Workbook

Aug 5, 2012

I am using MS Office 2010. I want to count---on multiple sheets---the number of times that a given cell is greater than another cell if and only if a third cell is equal to a given value. I want to do this for 4 sets of data on each sheet. I thought I had it figured out with this formula---

=SUMPRODUCT(COUNTIF(INDIRECT("'"&$H$1:$H$43&"'!$R1"),2*(AND("'"&$H$1:$H$43&"'!$E1">"'"&$H$1:$H$43&"'!$F1"))))+SUMPRODUCT(COUNTIF(INDIRECT("'"&$H$1:$H$43&"'!$S1"),2*(AND("'"&$H$1:$H$43&"'!$G1">"'"&$H$1:$H$43&"'!$H1"))))+SUMPRODUCT(COUNTIF(INDIRECT("'"&$H$1:$H$43&"'!$T1"),2*(AND("'"&$H$1:$H$43&"'!$I1">"'"&$H$1:$H$43&"'!$J1"))))+SUMPRODUCT(COUNTIF(INDIRECT("'"&$H$1:$H$43&"'!$U1"),2*(AND("'"&$H$1:$H$43&"'!$K1">"'"&$H$1:$H$43&"'!$L1"))))

but it returns a value of zero each time. Clearly there is an error in the formula.

Here is some background:
-- $H$1:$H$43 is a block of cells that has the names of the sheets in the workbook
-- E1 and F1, G1 and H1, I1 and J1, K1 and L1 are the four groups of cells that I am comparing.
In the entire workbook, I want to add 1 (counting function) only when:
R1=2 AND E1>F1 or
S1=2 AND G1>H1 or
T1=2 AND I1>J1
U1=2 and K1>L1
on each appropriate sheet in the workbook.

View 1 Replies View Related

Combine Workbooks With Multiple Sheets Into 1 Multiple Sheet Workbook

Mar 16, 2008

I have about 20 workbooks with different file names for different projects all saved in the same folder. Each workbook has about 10 worksheets and each worksheet is named in a similar fashion in each of the 20 workbooks (eg. revenue, cost, variance etc.). I want to pull out a worksheet named ' forecast' from each workbook into a master workbook so that the master workbook would contain the 20 forecast worksheets.

View 9 Replies View Related

Generating A Sequent Number Value In One Workbook And Copying It Into Another

Apr 28, 2006

I have these two woorkbooks. One serves as a register of warranty cards and the other as a template of a warranty card. For each new warranty card I need the register to generate automatically a new consecutive number. This new number should automatically be loaded in a specific cell in the template document after opening it (with a hyperlink or a button from the register, for instance), so that I don't need to mannually type the number in the template.

View 3 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

Copying Rows From Workbook Containing Data To Template Workbook

Mar 6, 2014

So I basically have a template workbook that the code is stored in. I need it to pull an entire row if Column C in workbook "rawdata" contains specific text, in this case "PRCH - Purchase".I have never had to do anything like this before, it has always been working in the same workbook. It's failing at the 'mp = ...' line every time. There might be other errors in the code too, I just cannot resolve the first one!

[Code] .....

View 5 Replies View Related

How To Protect Multiple Sheets In Workbook

Jun 19, 2006

How to protect multiple sheets in a workbook and not having to protect them 1 by 1. I have copied and pasted all the different macro's/visual basic script that has been posted for that purpose, but I can't get it to work and I'm always getting an error. The error from visual basic says "compile error: invalid outside procedure" and then the visual basic screen shows the following:

Range ("AM52")
If Ans >= 0 Then
"+."

It does not like the "AM52" part because it is highlighted in the error message.

Also, the error I get from recording my own macro step by step is "Run time error 40036" from visual basic.

View 8 Replies View Related

Copy Multiple Sheets To New Workbook?

Mar 31, 2014

I am looking for some code to copy the exact values in a couple sheets over to a new workbook. There are images in the sheet that need to come over and formatting of cells including merging.

View 2 Replies View Related

Sort On Multiple Sheets In Workbook?

Nov 18, 2013

Trying to sort on multiple sheets in the workbook. The range that is to be sorted will vary on each sheet, so i would like to write the range as .end(xlDown).Row and then do the sort. So far, what I have written is giving me a type mismatch error

Code:
.Sort.SortFields.Add Key:=Range("B2:B" And Range("B2")).End(xlDown).Row, _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal

View 3 Replies View Related

Vlookup In A Different Workbook But Multiple Sheets

Jan 18, 2007

I have this one sheet (File 1) where I have the unique codes of people and am trying to perform a vlookup() for a value by specifying the lookup in a dfferent workbook (File 2) but multiple sheets. In other words the data (unique codes) is scattered in different sheets in that workbook (File 2). I need to perform a vlookup() wherein the codes finds a match in whichever sheet in File 2 and the value in the specified column be entered against the respective cell in File 1.

I tried selecting all the sheets in the formula but it does not return a value for all the inactive sheets in File 2. Vlookup() works fine for the Active sheet only.

View 9 Replies View Related

Searchbox On Workbook Multiple Sheets

Apr 11, 2007

I have a workbook that contains 25 worksheets and in those sheets there are common items for different equipment, all the sheets are exactly the same when it comes to lay out, except the first sheet, the data differs accordingly on the subsequent sheets. Being new to excel I do not have a clue how to set a seach box at the click of a button and copy and paste the part searched for thru all the sheets in the first sheet and at the same time deletes the latest search when a new one is carried out.

View 9 Replies View Related

Exporting Multiple Sheets To Another Workbook

Feb 12, 2010

I expect this may have been done before, I have a workbook with 6 sheets. Each sheet lists a register, each register has between say 12 & 25 column, 1 column in each sheet denotes a "y" for exporting to another spreadsheet (not the same column in each sheet though)

what I would like is some code that will open a new workbook, and copy each of the sheets (all the fields/columns etc) into the new book, but only the lines that have the "y" next to them.

I have codes that export one sheet , but its not really relevant to what i need to do.

View 9 Replies View Related

Unhide Specified Multiple Sheets In A Workbook

Jun 27, 2006

I would like to unhide specified multiple sheets in a workbook at one go. What I'm doing now is something like this:

Sheets("Source 1").Visible = True
Sheets("Source 2").Visible = True
Sheets("Source 3").Visible = True
Sheets("Source 4").Visible = True

I managed to get the array function when I want to hide the sheets:

Sheets(Array("Source 1", "Source 2", "Source 3", "Source 4")).Select
ActiveWindow.SelectedSheets.Visible = False

but I can't do this when I want to unhide them. I do not want to unhide all sheets in the workbook, only those I specify in the code. How can I use the something like the array code to unhide the sheets.

View 9 Replies View Related







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