Msg Box To Create New Workbook
Aug 24, 2008
way to create a msg box with if you click "yes" it will copy the data from sheet 4 on workbook 1, and paste it onto a new workbook that is a copy of a standard template of workbook 1, and rename it based on a file name you give it.
ex. Pro Shop Template
Workbook 1 is Pro Shop 9/08-10/08
New Workbook 2 is a copy of Pro Shop Template but names Pro Shop 10/08-11/08
View 9 Replies
ADVERTISEMENT
Jun 2, 2014
I wrote a code in unshared workbook and it works fine. But when i make it shared i get Run-time error '1004' Delete method of worksheet class failed.
The Deleting of worksheet only occurs once (when the new wb is created) so is there i can unshare and share it back when the process is complete?
View 3 Replies
View Related
Jul 16, 2012
I have been tasked with creating a macro which creates a new workbook wherein each sheet contains the information for one site from the active sheet. The active sheet already has the values sorted by the site such that all information needing to be copied from the active sheet into the new workbook is together.
I.E.
ATL
ATL
ATL
ATL
CEN
CEN
JCK
JCK
etc.
There are 8 different sites on the active sheet: ATL, CEN, DAL, HAR, JAS, JCK, VIS, NOV
The macro needs to find the range for all of the data of each site and copy/paste that data into a new workbook such that ATL would have its own sheet, CEN would have its own sheet, and so on. The data ranges from A:R.
So, for example, the macro would find that the last row with ATL in the "B" column is 6095 and would then copy A2:R6095 and insert that data into the new workbook under Sheet 1.
I had some code that I had adapted to select the range for each of them, but the code loops through the entire sheet (which is 44,307 rows long) for each site making it a quite clunky and very slow step in an even longer macro. Since the data is already sorted, I know there must be a way to have the macro stop searching when it reaches data not equal to the data the row before, however, my experience with VBA is limited, and I have been unable to find a solution. Also, the data does not have to be conserved after being sent to the new workbook, if that would speed up the macro.
View 5 Replies
View Related
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
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
Sep 9, 2008
Is there a way of creating a new excel workbook using a macro that is stored as an Add-In.
The new workbook is to be created in the same folder. If I use the following command in macro then it saves the file in the Add-In folder.
View 14 Replies
View Related
Jul 10, 2009
I need a macro that will copy and paste the data from the range below from every file in a directory with each file in the directory on a new row. My goal is to build a database with the information in the files in the directory. I will need to be able to put the directory in the code at a later time as it has not be set up yet. it will be on the local computer and not on a network share.....
View 8 Replies
View Related
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
Apr 15, 2014
I am new to macros on excel but I am trying to create a cash up workbook. This is what I want it to do:
First Sheet should be a summary of the month with each day. From there I want it to generate 4 worksheets for every day's cash up. (which should be Daily Cash up, Credit Card Sales, Cheque Sales & Account Sales).
The Daily Cash up Sheet must pull info from the other 3 and must allow me to input cash values manually. But the cc sales, cheques sales and account sales must be pulled from the other sheets.
After completion of cash up there should be a button on the Daily cash up sheet to say Finalise, where when it is pressed it summarises all totals on the first sheet. So when I open the workbook every morning, there should be a button on the first sheet to create a new 'cash up'.
Then there should also be a button on the first worksheet for month end, so that when you press month end it finalises the month and generates a new work book for the next month.
View 7 Replies
View Related
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
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
Aug 5, 2003
I want to include a help section in a workbook I created. I need something more than just a MsgBox ;-)
I'd like it to be like the windows' help that you have everywhere.
View 9 Replies
View Related
May 31, 2006
I want to the following steps to be done by vba of excel.
1. copy ranges of cells in the active worksheet (sheet3)
2. add a new workbook and paste the copied ranges to sheet1
3. save the new workbook with the new file name (e.g. date)
4. close the new workbook and clear the contents the copied ranges of cells in old workbook.
following code and make it more simpler?
Worksheets("Sheet3").Activate
If Range("l1").Value <> "" Then
Range("l1").Value = CDate(Date)
End If
asdate = Range("l1").Value 'date entered by user
resp4 = MsgBox(" Case particulars of " & asdate & " will be backed up and deleted from this sheet! Proceed? (Y/N)", vbYesNo, "Deletion of Data")
If resp4 = 7 Then
Exit Sub
View 11 Replies
View Related
Nov 28, 2007
I am fairly new in Macros, I have a workbook wich will have some data for each year month, the new month ( sheet) data will be added by a macro, copying the current sheet (month) as a base. When all months are created I need to create new workbook with only Jan (January) sheet. I created the following macro, but I think it could be reduced, in code lines, and need to how to create the new workbook based in last (December) sheet.
Sub AddSheets()
Dim wSheet As Worksheet
SheetName = ActiveSheet. Name
Select Case SheetName
Case "Jan"
On Error Resume Next
Set wSheet = Worksheets("Feb")
If wSheet Is Nothing Then
'Add Sheet Code
Sheets("Jan").Copy After:=Sheets("Jan")
ActiveSheet.Name = "Feb"
Sheets("Feb").Select...................
View 3 Replies
View Related
Jun 17, 2008
I'm trying to create a new worksheet just in memory.
Private Sub test()
Dim wsheet As New Worksheet
Dim a As Variant
a = ActiveSheet. Range("A1").Value
wsheet.Range("A1").Value = a
End Sub
When I run this, the like "wsheet.Range("A1").Value = a" gives the error <Class does not support automation or does not support extended interfaces. I could use that vitual worksheet (I call) to do functions like sorting filtering and other things without affecting the actual data, and get only the results. Is there a way to create such virtual worksheets.
View 6 Replies
View Related
Oct 23, 2012
I'm working on a time system tracking, and I want to know if it's possible to have a button for authorization (and sent by mail to me) to authorize or reject the workbook..
do this automatically in vba macros?
View 1 Replies
View Related
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
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
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
Jun 2, 2008
if it's possible to create a statement from cells in a workbook perhaps by using the hyperlink option or if there is any other alternative way.
In brief, the statement should recognise what has been inserted into each cell in the row and then generate a statement.
I hope this is clear. See attached a copy of the excel sheet from which I would like to create the statement.
View 9 Replies
View Related
Nov 11, 2011
Sub Macro2()
Dim stgSheets As String, Cnt As Long
Dim arrSheets()
Cnt = Sheets.Count
ReDim arrSheets(Cnt - 1)
For i = 1 To Cnt
stgSheets = stgSheets & Sheets(i).Name
arrSheets(i - 1) = stgSheets
'sSheets = sSheets & "", ""
Next i
[Code]...
View 2 Replies
View Related
Nov 15, 2011
Code that will autofilter my sheet for rows that contain either a 1,2,3, or 4 in Column "Z". Then, create a new workbook for each unique value in column "O" and save that to a folder on my desktop named "Contracts". Next, while still filtered by by "Z" and for every unique value in column "O", filter and name a sheet in the new workbook for each unique value in column "B". Finally, while the main sheet is filtered I need to copy and paste the visible cells (minus header row) from columns C,D,E,F,G,H,S, and U to consecutive columns in the newly created worksheet beginning in cell "A9".
I am using excel to create some contracts for a few partners. Each partner could work with several of my clients and I need to give each partner a personalized contract for each of my clients with which they work.
I hope my description of the problem is not too confusing. If so, let me know and I will try to clarify exactly what I am trying to say.
I have tried to combine some code that I already have but, being a newb with loops, I can't seem to get it to do everything.
View 1 Replies
View Related
Apr 27, 2013
I want to write a piece of code where each day i run this code
I want add a workbook
Copy range ("A1:C5") to this new workbook
Save new workbook in a particular folder with the name customer data and todays date and save as CSV file
I run this this code every day so it should only add todays date at the end for filename
If for some reason I run this code again in the same day..
I want to have a msgbox stTing you have already ran this code today and exit sub
View 4 Replies
View Related
Oct 12, 2008
I'm trying to open a file and perform various tasks. This is the structure:
Dim xlApp As Object
Dim xlWb As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWb = xlApp.Workbooks.Open(BackupFile) ' backupfile evaluates to c: esting est.xls
xlWb.Worksheets(1).Activate
Debug.Print xlWb.Worksheets.Count
Dim ws As Worksheet
For Each ws In xlWb.Worksheets
Debug.Print ws.Name
ws.Activate
Next ws
I think I'm totally missing something. The above works, except for the loop. None of the names show up in my immediate window, and none of the worksheets are activated. xlWB evaluates to nothing, which is where the problem has to be...but why would my first .Activate and Debug.Print lines work? Also, If I declare xlWb as Workbook then absolutely nothing works after the file is opened.
Basically what I want to do is open the file, do a bunch of a stuff with it, then save and close it. I have this all working without creating another object, but the opening of the file is still visible to the user. Seems like turning off ScreenUpdating doesn't truly work.
View 9 Replies
View Related
Oct 28, 2008
I have a table of data with three columns. In the first column I have different values, but they can also repeat. How can I have VB look at my table and for every distinct value in the first column create a sheet with the value name and paste all the data into that same sheet?
View 9 Replies
View Related
Feb 23, 2009
I have one excel file with several columns and rows of data.
Then I have a template excel with titles and some tables (no formulas, no macros, etc).
I need to generate a new workbook (based on the template) for each row of data from the source excel.
View 9 Replies
View Related
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
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
Nov 26, 2012
I have an excel workbook that serves as a master workbook. I have to create 30 copies of this workbook, 1 for each site. Each workbook will have small differences in the data held. This is because I will refresh the sheet before saving it. There is a dropdown list on the 1st tab of the workbook that contains the names of the sites. The sequense, I suppose would be like: select the next name on the dropdown list"calculate" the spreadsheet to enable the refreshsome sort of "save-as" with the name from the dropdown list forming the name of the file. The Master file must be kept intact.select the next name from the dropdown listcalculate the sheet ........and so on I have a few other things I will add to the script like Protect Sheet etc.
View 1 Replies
View Related
Jul 3, 2013
I need to consolidate a lot of information from multiple workbooks all the workbooks are located in a folder, i am not bothered about running each one separately or a group at a time, each work book has ten sheets with each sheet in the workbook being different, it needs to add to the next blank row on each sheet.
View 1 Replies
View Related