Add-in To Saving Groups Of Worksheets As A Single Workbook
Oct 7, 2008
I have another little conumdrum I'm trying to work out.
I'm using one of Ron's scripts as an add-in which I've just amended the output path for.
http://www.rondebruin.nl/tips.htm
This script essentially creates a new workbook from each worksheet in the active workbook.
As I have a workbook of about 500 worksheets, I am trying to group the worksheets opposed to having to split all and rejoin them manually.
Luckily all of my worksheets names are initials with numbers after them (as assigned by excel when merged):
e.g., RH, RH (2), RH (3), RH (4), AG, AG (2), AG (3) and so on.
That said there are some random ones too, but I'm happy for them to be kicked out as individual files.
Anyway I'm pretty sure there is a way this can be added into this existing script by addressing Sheet.Name perhaps but I'm a bit unsure exactly..
Sorted in order (i.e. 2,3,4) would also be a bonus but not essential as they need to manually checked and I have a separate macro for sorting worksheets anyway.
I have been trying to create a Macro that can do the following.
Open a Excel Workbook, Copy the Worksheets that I need (ignoring ones that are not needed.), Save them in the correct location with a new folder of date and time and saving them as csv files.
I have all the elements but can't seem to get them to gel correctly.
Just wondering if anyone has anything like this that I could adapt or edit.
I used VBA codes to apply different passwords for different worksheets in a single excel workbook. They worked fine. Then i applied a password to the VBA code itself through the VBA project properties. Also worked.
But my problem is that, if any one enters a wrong password to open any of the worksheets, the VBA will open an error message window and when "end" option is clicked, the VBA code will open without any prompt for the password.Thus the entire purpose is defeated.
I am trying to quickly transfer all worksheets in a directory into one worksheet listing all worksheet names in the tabs in number order.
The formula have so far is below. But it does not name the individual tabs as the worksheet names in no order.
Sub GetSheets () Path = "Y: Filename = Dir(Path & "*.xls") Do While filename "" Workbooks.Open Filename:=Path & Filename, ReadOnly:=True Sheet.Copy After:=ThisWorkbook.Sheets (1) Next Sheet Workbooks (Filename) . Close Filename = Dir () Loop End Sub
The worksheets appear as follows 1982-001, 1982-003 up to 1982-250 ( I want them in single workbook but as multiple tabs in number order)
Basically, i have a common workbook template that is used by multiple users across the business to request a cost for numerous new products.
Within the template, there is a common section at the top, where specific project information is entered. There is also a table beneath where 1 or many products can be entered, with specific information relating to that product in the same row.
All the submitted requests are uploaded via an email attachment, to a particular sharepoint directory.
What i would like to do in the master workbook is the following:-
1. Open in turn every uploaded workbook within the sharepoint directory and copy the following cells into the master workbook, each in it's own row (or next available), with the data in adjacent cells.... 1st cell to enter data is $B6.
Cells to copy from each sheet:
Common info contained within cells: $DG$2,$N$11,$N$12,$N$19,$N$13,$AO$7,$AO$8,$AO$9,$AO$10,$AO$11,$AO$12,$AO$12,$AO$13,$AO$14,$BO$8,$BO$11,$BO$14
Product specific info: $U37, $AD37, $AH37, $DH37, $C37, $O37
Depending on the number of products requested, we need to repeat (loop?) until it finds the next blank row in the table. I have hidden a blank row in the table, so there will always be one!
All of the common information needs to be included for each product specific entry.
For each file, once the upload has been completed, i would like the file to be moved to another "archive" directory.
I have attached the template for information. The master workbook is still in development so can't share currently.
I have a fairly large set of data on one sheet containing numbers for 60 different people. The data is set up similarly to the set below:
John Smith 75 John Smith 80 John Smith 62
Jane Doe 49 Jane Doe 89 Jane Doe 66
So on and so forth until the 60th person. My question is: Is there a way to average the numbers for each different person at one time? What about median and mode as well? Do I need to set up a different sheet for that?
I am trying to find a way to sort a string of numbers within a cell in numerical order as they are entered,regardless in what order they are entered. Example 123,45,478,12 entered cell, and want it to sort in numerical order as it gets entered in the cell...12,45,123,478,4564
I'm looking to do some simple maths with ranges in Excel but I'd like a way to be able to input all these formulas automatically although I am pretty sure a single formula per column could do it all automatically. I've got to put the sums in AD to AF on the first line of each location, but the maths is for the entire location's range.
I'd like to be able to have a macro that will create a pivot table based on a range, open up each of the total rows within the pivot table (which will create a new sheet), name the worksheet the title of the total row corresponding to it then copy each worksheet created by the pivot and paste into another sheet in a required format.
I have a data sheet of 190,000 lines. It is a telecommunications bill with has approx 15 columns.
I need to separate the spreed sheet into the respective "call types" and put this data onto separate tabs, at the moment I do it all manually with Excel 2007.
Is there a way of automating this separation of data
I have a workbook that lists system analysts and information on the systems they're responsible for. I would like to have an Excel macro that will:
1. Create and name a new worksheet for each UNIQUE value in the 'Name' column (new worksheet for each analyst) 2. Copy their system info to each respective worksheet
I currently have a application that people fill out on a userform. When they click on a command button at the end it puts all that information on a sheet i made and then we print it off. My objective is when it saves it to the sheet it also save a copy of that paticular sheet in a seperate location such as H:/applications. Also the copy should be renamed to the information thats in a specific cell Such as j4 the have this text added after that "Application"..
I want to save a single sheet from my Excel file to PDF. But this Macro saves all the sheets in separate pdf files. How do I adjust it to only save the breakdown sheet of my Quoting workbook?
Sub Save2PDF() ' ' Save2PDF Macro
Range("L66").Select ActiveWorkbook.SaveAs FileName:= _ "Macintosh HD:Users:myratriegaardt:Desktop:Q1Breakdown.pdf", FileFormat:=xlPDF _ , PublishOption:=xlSheet ActiveWindow.SmallScroll Down:=-160 End Sub
is it possible using vba ideally with a button marked save, to save a single worksheet and name it, in CSV format
Then I would like to be able to do the reverse load a CSV file back in to a work sheet
Expanding upon this
1. Click a command button with caption “save”
2. Take the name of a given sheet, in my case DataToUpLoad and append it with a number to give a sheet name of DataToUpLoad 1 the first time it is save and DataToUpLoad 2 the next time and so on
3. Click another command button with the caption “load” interact with usual dialog box.
My current work around is to copy a sheet open a new work book past the sheet in the save that work book as CSV
The reason this is required is to mate up with the php on the server side
Trying to create a new workbook from another open workbook, then copying all the sheets that aren't called "Summary" to that new open workbook and then saving it. I get a subscript error on this line:
i have a workbook blank template for my colleagues to fill in, they fill in this blank template and save it under the serial number of the item they are creating. However a lot of errors exist when they input the serial number inside the workbook where the serial number is a duplicate of a former serial number.
Anyhow i was wondering is there any way when they input the serial number into the worksheet that i could get it to save in a separate workbook and then have conditional formatting to check those serial numbers in the workbook to see if they match?
I am trying to e-mail a portion of a spreadsheet that I have. My approach is the following: I save a copy in a temporary folder, open that copy, remove all the sheets that I don't need to send out, save it (same name as the e-mail subject), and then e-mail as an attachment.
The current approach does not remove the macros and references though. I use the following to remove the macros and references:
I have this code (got it from here: [url] that saves worksheets as separate workbooks. It works perfectly fine for that but I would like to save each worksheet as a text file (tab delimited). I tried changing FileFormat:=xlNormal to FileFormat:=xlFile but a debug error occurs.
Sub MakeMultipleXLSfromWB() 'Split worksheets in current workbook into ' many separate workbooks D.McRitchie, 2004-06-12 'Close each module AND the VBE before running to save time ' provides a means of seeing how big sheets really are 'Hyperlinks and formulas pointing to other worksheets within ' the original workbook will usually be unuseable in the new workbooks. Dim CurWkbook As Workbook Dim wkSheet As Worksheet Dim newWkbook As Workbook Dim wkSheetName As String Dim shtcnt(3) As Long
I have a huge workbook that takes up a lot of memory. The user saves her work every day by saving the entire workbook. Hence, we are using up a lot of hard drive space. I have been trying to find a way to save the relevant worksheets in a format that consumes less disk space. I find that if I save a single worksheet as a web page without the option of interactivity the file is only about 50k. But I need to save three worksheets, not just one. Is there any way to do this? If not, is there any other SAVE AS method that allows one to save three worksheets at a reduced file size? I do not need interactivity, I simply need for the user to be able to go back and view the relevant information in each file.
In my program I have prevented the user from saving the Workbook with the following code
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim p As String Cancel = True Do While Cancel = True p = InputBox("Enter password to save file:", "Password Required To Save", "") If p = "Enter Password Here" Then Cancel = False Else yn = MsgBox("Wrong password. Try again?", vbYesNo, "Invalid Password") If yn = vbNo Then Exit Sub End If End If Loop End Sub
I also need to prevent the user, when they use the save as, from saving certain worksheets. Ex: There are 6 worksheets in the workbook. I only want them to be able to save the first three. Issues: One of the workbooks that I want to allow them to change has a tab name that changes frequently.
I have a workbook with several worksheets in it. 4 of them have macros written in them, some do not. I protected each sheet with a password and made it so that users couldn't select any "locked" cells, and did this on ALL the worksheets. I noticed now that, just upon opening the workbook (not running any macros yet), on the sheets with macros I'm able to select locked cells (which is wrong), but the sheets without macros still function correctly. I think that this may have to do with Excel's default protecting arrangement where you can select either locked or unlocked cells. I specifically locked all worksheets with the correct arrangement but every time I open the workbook some of the worksheets default back to Excel's default arrangement. What can I do about this problem? I need this configuration to follow the workbook and not the specific computer it's on. Many users are going to use this, and can't be able to select locked cells. My macros do unprotect and re-protect the sheets to run, and I'd wonder if I can edit these to protect the sheets in a different configuration (which I don't think I can do with regards to being able to select locked cells) but these macros don't even run before this happens, and the worksheet open event doesn't involve any unlocking or re-locking (it just disables the cut and drag-and-drop functions.
To this point I have been able to successfully write code that will save a constant set of worksheets as a pdf. However, I would now like to alter it to be able to dynamically select the desired worksheets from a list box (I have been able to populate my list box) and then save as a pdf. The last step is where I am have issues. This is what I have thus far..
Dim relativePath As String Dim Selected As Long
For Selected = 0 To ListBox1.ListCount - 1 If ListBox1.Selected(Selected) = True Then Sheets("Summary").Range("Q65536").End(xlUp)(2, 1) = ListBox1.List(Selected) ListBox1.Selected(Selected) = False
I will shortly be running a project over a twenty four hour period, where a group of people will be inputting data into a workbook (one worksheet per hour), and what I would like to know is if it is possible, to input some coding into a thisWorkbook module to action a save on the workbook every time an entry is placed in column A (of each worksheet) which is divisable by 10 (a10, a20, a30 etc).
I'm trying to find a way to save a single sheet of an excel workbook and in the same process delete all vba code and shapes from the new single sheet workbook. I was looking around and found this code which does save only the single sheet to a new one sheet workbook but doesn't delete the vba and shape that I have used to assign macros to in the original.
Code: Sub SaveSheetAsNewBook() Dim wb As Workbook Dim InitFileName As String Dim fileSaveName As String Dim wshape As Shape InitFileName = ThisWorkbook.Path & Format(Date, "mm.dd.yy")
I have multiple workbooks ( with unique names) under same folder. Each workbook has "Report-Corn" sheet.
I would like to copy cell "P15" from each (workbook-> report-corn -> P15) and paste to Master.xls workbook -> Sheet 1 one after another which is also located under same folder.
I have an Excel doc with ~20 tabs. Each type represents 1 type of activities (soccer, tennis, etc). The size of the file (with the 20 tabs) is pretty significant (>1mb), which jams our email traffic.
Is it possible to: - keep this workbook with the 20 tabs when open by the user; - let the user select and fill in whatever tab he needs (just one at a time); - have a button for the user to click that will save only this tab with a different filename (therefore, when sent by email, the file should be pretty small).
As I've learned to develop Excel apps with vba over the years I've noticed that, if the Excel app starts to get too large (over 1MB) saving it will often cause the application to crash for no apparent reason - the result being that I lose all the vba code I entered before the last save - with the worst case being that, on occasion I have lost all of the vba code in an applications!!!
So, I've learned to back up often using a third-party utility that I use to save my applications, which works wonders in allowing me to save my application without it crashing. The application is called Code Cleaner 97.exe. It was designed around Excel 97 (which I still use) but if possible I'd like to get an updated version for Excel 2003 and Excel 2007, which I also use.
Does anyone know of a more recent version of this utility, or another similar utility that allows large Excel applications to be properly saved, etc?
Code Cleaner 97.exe was a freebie that was available through one of the old Compuserve Excel forums. It was a very popular utility and was suggested as a means to save one's Excel apps without the app getting trashed, etc.
I'm not expecting a freebie solution so I'll gladly pay for something that allows me to save my large Excel apps without them crashing, etc.