Allow Users To Save Specified Worksheets To Workbooks
Oct 1, 2006
Sub SheetArray()
'I need the code to bascially loop through the workbook _
identify the worksheets With Priority In thier name And _
Then create an array variable such As _
Sheets(Array("Priority A1", "Priority A2", "Priority A3") _
At this point I can Then select the sheets And save them off To _
another workbook. The issue I have appears simple but I 'm lost as _
To it 's solution. Any help would be greatly appreciated as I have _
been stuck on this For days
Dim ws As Worksheet
Dim ShShortName As String
Dim SheetString As String
For Each ws In Worksheets
ShShortName = Left(ws.Name, 8)
'Debug.Print ShShortName
If ShShortName = "Priority" Then
SheetString = SheetString + ws.Name
End If
Next
Debug.Print SheetString
'basically I'd like to use the SheetString value above to _
create the arrray variable As above In the comments. The _
reason I want it To use the Loop To assign the variable Is because _
at any one time I 'm not sure as to how many priority sheets I may _
have In the workbook, And this will change constantly
End Sub
View 8 Replies
ADVERTISEMENT
Dec 6, 2009
I have a workbook which have worksheets say A to J. I wanted it to be separated into 10 different workbooks A.xlsx, B.xlsx, C.xlsx and so on in drive C. Could anyone help me here?
View 6 Replies
View Related
Aug 22, 2006
I want to do is save each worksheet in a workbook to an individual workbook with the name of the worksheet. After executing the code below the strangest thing happened in that each saved workbook contains the lines ...
View 5 Replies
View Related
May 30, 2008
I have a workbook with approximately 30 worksheets. This workbook already has a massive macro that I've written. I'd like to write a code that will take a designated worksheet, check to see if there is data in cell A2, if so, save it as a new workbook.
The name of the workbook should be predetermined, for example "SIA April(Previous Month) 2008(Current Year) P-Card Import Template.xls"
The months and years will need to change.
The file to save it in will also change monthly- for example- G:PCard DirectoryCloses2008 ClosesApril(previous month) 2008(current year)
View 9 Replies
View Related
Dec 3, 2012
I have an expense report, which was originally done in Excel 2003. It still prompts users to open as read only however if they select no, they are not prompted for the password, and it has allowed them to save, so when the next person opens it, they have the previous person's report instead of the clean workbook. I have tried everything to put a password onto it. I know this is really basic stuff, but maybe I am missing a step? I want the end user to be able to make all the changes they want in read only mode and then do a save as, but if the select No when prompted "Open as Read-only?" they should have to put a password in.
View 4 Replies
View Related
Apr 6, 2009
When saving a file, you get a popup with a suggested path. I need to find a macro that will either offer a suggested file name based on a cell's date value (a1) and a suggested path (to the desktop) for any user that uses the spreadsheet - or simply will save the file using the cell value as the name to the user's desktop.
Each user will have their own version of the file, to save to their own desktop. The macro will need to overcome the issues that each user's path to their desktop will be unique since each will have logged in to the window's session with their own profile.
View 5 Replies
View Related
Aug 16, 2007
I have a summary workbook that I want to save into different folders designated by the input from my userform. My directory has folders named: "A051 - Watson", "A052 - Gila Bend", "A065 - Tompkins"... etc; but I want to designate which folder to put the summary workbook in by the first 4 characters in the folder names(A051,A056,A055...etc) Let me know if I made it clear enough.
View 4 Replies
View Related
Mar 11, 2014
Is there a way to prompt users to enter information in a specific range of cells before they save?
View 1 Replies
View Related
Jun 26, 2014
I have 25 files with certain worksheets that I need to move to 25 other files.
Worksheet 1, 2, 3 and 4 in Workbook A needs to be moved to Workbook A-2014 Worksheet 1, 2, 3 and 4 in Workbook B needs to be moved to Workbook B-2014 Worksheet 1, 2, 3 and 4 in Workbook C needs to be moved to Workbook C-2014 etc....
Is there a way to do this with a macro? Preferably I would like to do this automaticly - i.e. runing the macro from a master file that
1. Opens Workbook A copies the worksheets
2. Open Workbook A-2014 paste the sheets
3. Save and close Workbook A-2014
4. Close workbook A without saving
then doing the same for Workbook B, etc.
View 5 Replies
View Related
Dec 2, 2009
I am using a macro to open .txts in excel in seperate workbooks
I look for a macro to save all open woorksbooks in .xls
View 12 Replies
View Related
Oct 22, 2013
I am using this code to save all files in folder as CSV . I would like to add a letter to the beginning of file name for each file starting with a for file 1, b for file 2 etc.
Code:
strFile = Dir(mFolder & "*.xls*")
Do While strFile ""
Workbooks.Open mFolder & strFile
Range("D1").EntireColumn.Insert
[Code] .........
View 2 Replies
View Related
Aug 10, 2007
I have some code that basically searches through one Master Sheet (that the user will change each month) and based on some criteria, copies and pastes data onto 12 other sheets.
I was wondering how i make it so that the 12 sheets will save automatically as a different name depending on the date given on the original master sheet. For example, Master Sheet will have a cell that says September 07 and i want to save each of the other 12 sheets as "Name1_October 07", "Name2_October 07", etc. Is this possible to do while keeping the original Master Sheet along with the other 12 originals?
View 8 Replies
View Related
Apr 14, 2009
i have this macro to save as a csv this macro only save the workbook the you are looking at, i will like for this macro to save as a csv all open workbooks preserving the name of the xls file.
Sub SAVE_AS_CSV()
Dim strFilename As String
strFilename = ActiveWorkbook.Name
strFilename = Left(strFilename, InStr(strFilename, ".")) & "csv"
ActiveWorkbook.SaveAs filename:=strFilename, FileFormat:=xlCSV
End Sub
View 2 Replies
View Related
Oct 10, 2006
Every month I work on an audit that has data from 35 different distributors. I have code below that puts each distributors audit/sales information on a new tab and each new tab is given the distributors name. This also creates a new workbook for each distributor.
When the new workbooks are created, how can I name each workbook with the distributor name it's being created for? Is it possible to predefine a file path to where these new workbooks will be saved?
The distributor names I'm using are in column AF.
Sub FormatList()
'The code below creates and names a new tab for each members info
Dim ws1 As Worksheet
Dim wsNew As Worksheet
Dim rng As Range
Dim r As Integer
Dim c As Range
Set ws1 = Sheets("Sheet1")
Set rng = Range("Database")
'extracts a list of member or distributor names
ws1.Columns("R:R"). AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Range("T1"), Unique:=True
r = Cells(Rows.Count, "T").End(xlUp).Row
'set up Criteria Area
Range("U1").Value = Range("R1").Value
For Each c In Range("T2:T" & r)
'adds the member name to the criteria area above
ws1.Range("U2").Value = c.Value
...............
View 9 Replies
View Related
Oct 1, 2012
I need to copy a range of cells from various columns/rows from 1 sheet into 6 other sheets, but into a specfic range of cells(in the same workbook). I am looking for a code which would copy the cells, then allow me to save the sheets it has copied them to as seperate workbooks without loosing the values it copied. I would also like to make amendments to the cells which have been copied onto the other sheets, without having an error message if I type anything into the cells, also having any blank cells left blank rather than placing the 'o' value in the cell.
View 2 Replies
View Related
Jan 31, 2012
For example, I have 50 clients. In 1 workbook, I have a sheet for each client. When I'm finished with a particular client, I need their one sheet to place in their file and be done with it.
The current process is to open that 1 global workbook, copy and paste the sheet I need into a new workbook and go from there.
I was wondering if there is a simpler way to achieve this with VBA coding?
Ideally, I would like to click an object button and then be prompted to select a worksheet from a list that contains all current non-hidden worksheets.
Once I select a worksheet, I would then be prompted to save as and select a file path. That would save that specific client worksheet in its own file that I selected.
View 7 Replies
View Related
Jul 14, 2008
I have several workbooks (around 15) in one folder which all contain the same worksheets but with different data. The worksheets all have the same columns. What I would like is a way to consolidate each of the worksheets of the workbooks into one new workbook by running the code whenever I want it.
In other words I have workbook 1 till 9 which all have worksheet 1 till 3. And I would like to consolidate them into a new workbook with sheet 1 till showing all of the data.
View 9 Replies
View Related
Dec 21, 2009
I have a master tracking document that I use to record project information. My client sends me an updated schedule each week which may (or may not) have additional stores on it and some of the details of the stores may have changed.
I need a macro to capture these changes from the source spreadsheet (the one the client sends) and update the master tracker. The master tracker has a lot of additional columns of data that I add in myself about each project so I don't want to lose this information. The macro needs to see if the store on the source sheet is already on the master tracker and if it is then it needs to check to see if any of the columns below have changed.
If the store isn't on the master tracker then it needs to be added. There are around 750 stores on the master tracker at the moment so to do it manually takes forever!
Master Spreadsheet
Column A - Retail Region
Column B - Project Name
Column C - Postcode
Column D - Net Selling Area
Column E - Project Manager
Column F - Contractor
Column I - Start On Site
Column J - Launch Date
Source Spreadsheet
Column C - Retail Region
Column D - Project Name
Column I - Postcode
Column J - Net Selling Area
Column M - Project Manager
Column N - Contractor
Column P - Start On Site
Column Q - Launch Date
View 9 Replies
View Related
Jul 7, 2006
I have three workbooks stored in the same drive(shared drive). Let's call them 1.xls, 2.xls and 3.xls. Each workbook has one sheet.Column A in all sheets is the same. I want to make the following linking:
-Column A of the sheets in 2.xls and 3.xls to be linked and get data from column A of the sheet in 1.xls.
-Column B of 1.xls to be linked and get data from column B of 2.xls and column C of 1.xls to be linked to column B of 3.xls.
So far it sounds easy. What I cannot find is what to do when I insert a row in the sheet in 1.xls and write something in column A. I managed from DATA- IMPORT EXTERNAL DATA to refresh column A of the sheets in 2.xls and 3.xls, so that these columns contain the updated information. I cannot do the vice-versa procedure: for example, to insert something in column B of the sheet in 2.xls and refresh the values of column B of the sheet in 1.xls. The fact is that when I insert a row in 1.xls the right references get lost and move one cell up. I want the references to remain stable. In a way the sheets are interdependent.
View 2 Replies
View Related
Apr 28, 2007
I have created a macro which unhides a sheet (Email) in one book and takes that info to #1 create an email and #2 open a new file and paste data into it.
Problem is, I want to go back to the first book and hide the sheet (Email) since other users will be using the macro. I keep getting a run time error 9 'Subscript out of range'.
I have my code below. I have commented out the last few lines that used to work before I had to open a new book first.
....
View 9 Replies
View Related
May 8, 2014
In the attachments is the original format of the workbook, but the sheets are blanco. Did this on purpose, because the info is sensitive.
Is there a method to delete the middle sheets, 'Total1999' and 'Klad1'?
Is there a VBA code do this in a lot of workbooks, the format of all these books are the same.
Plus I'll place them in one map if it's necessary.
View 13 Replies
View Related
Feb 2, 2012
I wanted to create a target workbook that is a subset of the source workbook
1) I want to specify a list of worksheets in the source workbook:
For Each WSCurrent In Sheets(Array("SheetA", "SheetB", "SheetC"))
Next WSCurrent
2) I want to them copy these sheets into another workbook (don't know how to code this)
3) I then want to hardcode all these sheets (I don't know the most efficient way to do this)
4) Lastly, I want to eliminate certain columns (can be fed through a hardcoded list of Columns to delete e.g. X, W, Z)
View 5 Replies
View Related
Jul 20, 2012
I'm trying to optimize code by avoiding activating other worksheets, but I'm running into a problem with a match function.
I'm using a workbook called "Template" and then opening another workbook called "DCP" and trying to use the match function to figure out what row data is on. I can get this first line of code to work:
HTML Code:
MatchedRowNumber = WorksheetFunction.Match(Combo, Sheets("Sheet1").Range("A:A"), 0)
However for that to work, I have to activate the other workbook. I want to avoid that and stay within the "Template" workbook. I think I need something like this:
HTML Code:
MatchedRowNumber = WorksheetFunction.Match(Combo, DCP.Sheets(DCPSheet).Range("A:A"), 0)
That one however doesn't work... looks like I have the wrong syntax.
Below is an excerpt for the code in case something is wrong with how I set the variables.
HTML Code:
Sub StockOrderByDCP()
Dim Template As Workbook
Dim DCP As Workbook
Dim MSS As Worksheet
Dim DCPSheet As Worksheet
[Code] ..........
View 4 Replies
View Related
Jun 3, 2008
I'm trying to copy worksheets from different workbooks to one workbook, but it doesnt work. This my code, can anyone spot the error?
The problem is that it stops at the workbook that all the worksheets are supposed to be copied to.
Sub Makro11()
'
' Makro11 Makro
' Makrot inspelat 2008-03-17 av White
'
' Kortkommando: Ctrl+w
'
namn = ActiveWorkbook.Name
ActiveSheet.Select
If ActiveSheet.Range("B3") = "" Then
ActiveSheet.Range("B3") = "v 16,"
End If
If ActiveSheet.Range("B3") = "v 15," Then
ActiveSheet.Range("B3") = "v 16,"
End If
ActiveSheet.Copy Before:=Workbooks( _
"KI.xls").Sheets(2)
Windows(namn).Activate
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
View 9 Replies
View Related
Feb 28, 2009
I have a few hundred multi sheet workbooks that have address data in one of the sheets that I wish to collate into a single worksheet to use as a mail merge with word.
View 5 Replies
View Related
Jul 12, 2006
I've got a macro that combines multiple worksheets and workbooks. Just a minor problem, the very last row of each worksheet is being deleted, and I can't seem to pinpoint the cause of the problem.
'This will copy data from all sheets of the selected workbooks
'To a sheet named 'Data' in the sheet in which the macro is run from
Dim pasterow As String
mainsheetname = ActiveWorkbook.Name
MsgBox ("Please select spreadsheets to combine")
filestoopen = Application. GetOpenFilename(MultiSelect:=True)
responseval = MsgBox("Do you want to leave the combined spreadsheets open?", vbYesNo)
Worksheets("Data").Select
Range("A1").Select
'open workbooks
For Each w In filestoopen...................
View 2 Replies
View Related
Jul 18, 2006
I have a master workbook that has three sheets: Application, Equipment, Storage. I have over 500 other workbooks that have those same three sheets in them. Those workbooks also have other worksheets that I do not want. How can I create a macro that will open every one of those workbooks and copy over the data from each one of those 3 sheets into it's counter part in the master workbook?
View 3 Replies
View Related
Sep 14, 2006
I have a workbook with multiple sheets and I want to make these sheets into separate workbooks. I need them to be saved in the same path as the original workbook and automatically named (same filenames as worksheet names). I tried a code from a VBA book, and I got "Object needed" error message.
View 3 Replies
View Related
Mar 2, 2008
I am trying to figure out how to count all open workbooks, then count all worksheets within the workbooks and come up with the total amount of worksheets in a message box. I know that it sounds very simple and probably is, but I really can't figure it out.
View 6 Replies
View Related
Mar 8, 2013
I have a macro that opens all workbooks from one directory and runs a macro for each workbook to clean up the data. I cannot figure out how to take all those open workbooks and save them to another directory and close the workbook. Also, I do not want the macro workbook (xlsm) to save. I only want it to close. I am working in 2007 Excel.
View 8 Replies
View Related