VBA To Delete Sheets When Save As

Aug 26, 2008

I have plenty of sheets in my spreadsheet but I need some of the sheets to be deleted before it can be sent to client due to sensitive data. Just to be proactive, some time I may not delete the sheet/s before I send it to client...and that means I am fired from my job.

How is it possible that before I save as my master spreadsheet, excel deletes some of the sheets (Names: "Cost", "Contacts","Vendor"), etc.

View 9 Replies


ADVERTISEMENT

Automatically Delete Certain Sheets Upon Save As

Sep 14, 2009

Our company has designed a Excel Document for quoting purposes. The problem we are having is that certain sheets that are needed to do the quote do not need to be used after the quote is finished and saved. These extra worksheets are taking up a lot of room on our server. In the document I have already disabled the save feature so that the saveas has to be used. Is there code that can delete sheets 3, 5, 6, 7, 8 upon doing a save as?

View 4 Replies View Related

Choose Sheets That Save Or Don't Save

Jun 4, 2007

I have 120 sheets in my workbook and I only need 5 of them to save when there are changes, the other 115 are were data is pulled from. Is it possible to tell excel not to look at a sheet when it saves? I'm just after making it save faster.
This is going to be a workbook that " moves" a round a lot, so I want to the 115 sheets in the same workbook.

View 4 Replies View Related

Delete Chart Series Across Sheets But Skip Protected Sheets

Mar 30, 2008

I have received following macro from someone to delete series but the problem is that it gives error when some sheets are protected, and I want those sheets to protected. When run it will ignore/leave protected sheets but delete series only from unprotected sheets

Private Sub CommandButton1_Click()
Dim Rng As Range, i As Long, r As Range, lVal, uVal
Dim DeleteCount As Double
Dim lRow As Long
Dim dr As Long
Dim dc As Long
dc = Sheets("Deleted Numbers").UsedRange.Columns.Count - 1
dr = Cells(Rows.Count, Sheets("Deleted Numbers").UsedRange.Columns.Count - 1).End(xlUp).Row + 1
If dr = 60001 Then ................

View 4 Replies View Related

Save As And Printout All Sheets

Apr 15, 2009

I wanted to make a macro that saved my worksheet, then printed all the different tabs. The save is, of course, easy. Printing all tabs is being more difficult.

I tried to use the macro recorder, but all it did was select range, and then name each tab.
My tab names change though, so I need something that will just select all tabs.

View 6 Replies View Related

Protect All Sheets Then Save

Mar 15, 2008

I have a workbook with several Sheets. I wish to automatically protect all sheets with specific user permissions, i.e. Select Unlocked Cells, Insert Rows, Use Auto Filter and Edit Objects, as I would have available when using the manual approach. Also, I wish to invoke a Password in the process.

Additionally, I need this code to operate when the file is Saved or Closed... transparent to the user.

View 9 Replies View Related

Delete Original Workbook After Save As

Mar 21, 2008

I don't believe this is possible but I've been wrong before.. Is it at all possible to Kill the current workbook using VBA? I " saved as" in another location and do not wish to keep the current workbook.

View 3 Replies View Related

Save CSV As New Copy & Delete Original

Apr 20, 2008

I was wondering if it is possible to have a macro running that will automatically save a .csv file to specific location and close the file. I would like to have the macro running so that as the files are opened they will be automatically saved to this location.

View 2 Replies View Related

Save Sheets With Specific Name From Excel To PDF

Apr 24, 2014

I have a script that opens the workbook Excel, and save him as PDF format. But my script saves all sheets in a book. I need to save only sheets with name "Cnt1", "Cnt2" .... "CntX".

Code:
Dim xlObj, objArgs, xlWB, xlSH
Set xlObj = CreateObject("Excel.Application")
Set objArgs = WScript.Arguments
file = objArgs.item(0)
fileToSave = objArgs.item(1)
set xlWB = xlObj.Workbooks.Open(file)
xlWB.ExportAsFixedFormat 0, fileToSave , 0, 1, 0,,,0
xlWB.close False
xlObj.quit

View 4 Replies View Related

Save Multiple Sheets As CSV Files

Oct 24, 2007

I will have about 20 excel spreadsheets that will need to be run through some data cleansing and validation than each one exported to a csv file (without the column headings on them), and saved as the same file name as the spreadsheet was. If there are errors in the validation process then the one that fails (row) will be copied to an error log spreadsheet. There will be multiple worksheets in the error log workbook (one for each of the spreadsheets – which I hope VBA can create). What I am doing so far is creating a loop that will run on all of the spreadsheets located within a folder.

'Procucedure that will run all validation processes and error checking on extracteds spreadsheets

Sub RunCodeOnAllXLSFiles()
Dim i As Integer
Dim wbResults As Workbook
Dim wbCodeBook As Workbook
Application. ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
On Error Resume Next
Set wbCodeBook = ThisWorkbook
With Application.FileSearch
.NewSearch..............................

View 3 Replies View Related

Macro To Save Certain Sheets From Excel Automatically

Jan 22, 2010

I'm not sure if this is possible but I want to be able to click print and after it has printed, transferred and cleared I would like it to save the purchase order and continuation sheet.

If this is being done on different computers is it possible for it to simply bring up the dialog box and the user save it where they would like?
Libby

View 7 Replies View Related

Macro To Count All Sheets In Workbook And Save As PDF?

Nov 9, 2013

I have a macro in a workbook that starts with one sheet (called Home Page), the macro opens other workbooks and copies sheets to add to the original workbook. When the macro has finished, I would like for a new macro to include all sheets into one PDF file. My problem the finished workbook will have a different number of sheets in it every time.

View 5 Replies View Related

VBA To Copy Multiple Sheets Into New Workbook And Save

Jun 23, 2014

I have managed to pull together code that does the required task - save two sheets from a work book in to a new workbook on to a dorectory each day. However I woul;d liek to paste special the values and cannot figure our how to reference that on the below:

'saves text file in day on day folder
Dim WS As Worksheet, CheminDest As String, fNAME As String
'create directories as needed
On Error Resume Next
CheminDest = "T:DMRatesReportsChecks" & Year(Date) & ""

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

View 3 Replies View Related

VBA To Create Individual Sheets From Workbook And Save

Feb 12, 2010

I have a workbook with roughly 28 tabs(sheets) and i need to be able to run a macro that will create a new sheet for each tab and name it based on the tab name.

View 9 Replies View Related

Macro: Save New Workbook After Copying Sheets To It

Nov 9, 2006

I am moving some sheets into a new workbook and from the new workbook I want to prompt the user to save the workbook where they see fit. For some reason I cannot seem to save the new workbook only the old with the below code.

Sub Moving
Dim wb As Workbook
Set wb = ThisWorkbook
Sheets( Array("Hk", "Li", _
"SAM")).Select
Sheets("SAM").Activate
Sheets(Array("Hk", "Li", _
"SAM")).Copy
If wb.Saved = False Then
Select Case MsgBox("Do you want to save your changes?", vbYesNo Or vbExclamation Or vbDefaultButton1, "J & R Solutions")
Case vbYes
wb.Close True
Case vbNo
wb.Close False
End Select
End If

View 2 Replies View Related

Delete Rows But Save Info Based On Three Different Criteria

Aug 13, 2012

I want to delete the rows if they do not equal "TL" based on certain criteria, but save the info
then delete the rows if they do not equal "Fedex" based on certain criteria, but save the info
then delete the rows if they do not equal "LTL" based on certain criteria

After the information has been filtered it is supposed to load to a template giving monthly information for each of the above, but this is not working

VB:
If Load = "LTL" Then
Range("A2").Select
Selection.Sort key1:=Range("F1"), order1:=xlDescending, Header:=xlYes
For x = 2 To TotalRows
If Cells(x, 6).Value > 10000 And Cells(x, 1).Value = "FEDX" Then

[Code] ....

I am pretty sure that my problem lies within the parenthesis where it says Rows("2:" & x-1).Delete. Am I supposed to put something else there since I am deleting rows based on three different loads?

View 6 Replies View Related

Way To Save A Logo In A Cell In Order To Reference It From Other Sheets

Nov 25, 2009

I have a multi-sheet workbook with a some raw data that I import into Excel from another system. I then perform calculations & summaries in one of 10 other sheets. In order to make it more readable, I world like put the company logo on the top of each sheet.

Is there a way to create a Input type of sheet that I put the logo in and then on each of reporting sheets do an ='Input'!location_of_logo_cell type of formula, in a similar way that I would pull data from that same sheet, like ='input'A1?. It becomes very labor intensive if I want to make changes to the logo and then copy it to every sheet.

View 2 Replies View Related

Export Selected Sheets To New And Save But Ignore Formulas

Mar 28, 2007

I borrowed the macro below from this forum. My formulas in the sheets I'm copying refer to other sheets that I'm not saving. can someone tell me how to change it so that it copies values only to the new workbook as I'm only saving it for records purposes and some cells are saved with #REF errors.

I'm guessing there's a spot where I should type .Value ? Copy.Value doesn't work.

View 9 Replies View Related

Multiple Sheets Copy And Paste Into New Workbook And Save As With VBA Excel

May 23, 2013

I want to copy 4 sheets and paste it in a new workbook and save it.

I have this code recorded

VB:
Sheets(Array("PIV", "Report")).Select
Sheets(Array("PIV", "Report")).Copy

But it don't work?

View 2 Replies View Related

VBA Create New Folder In Current Location And Save Selected Sheets As PDF

Feb 2, 2014

I have the below code that saves selected sheets of my workbook as pdfs in the current file location. What I would like this code to be able to do is to create a new folder (named with todays date), and then save each of the pdfs into this folder.

Code:
Sub SaveWorksheetsAsPDFs()
Dim sFile As String
Dim sPath As String
Dim fPath As String
Dim wks As Worksheet

[Code] ........

View 3 Replies View Related

Unprotect ALL Sheets, Create Folder And Save Copy On Desktop

Oct 23, 2007

I have a workbook which consists of 28 worksheets, all of which are protected, and are running on a code which automatically keeps all sheets at "unlocked cells" in the selection field. The sheet is also password protected for write-access…

I would like a Macro, or some sort of code, that when activated… it unprotects ALL sheets (which use same password), creates a folder on the users desktop, and saves a copy of the document in there… entitled "copy of {filename}" It must also remove the "write access" password…

View 9 Replies View Related

Quit Fullscreen, Hide Sheets, Save, Close On Userform Button

Apr 15, 2008

I have a fairly elaborate close-down routine for my workbook.

1) Quit out of fullscreen (restore initial state of excel before saving)
2) Hide all sheets but one (enforces cant do anything unless macros enabled)
3) Automatically save without a prompt
4) Close the workbook

I've researched it well and implemented it to the point where it works, but only if the user clicks the excel application close button -- the "X" in the titlebar (hence not in fullscreen).

However, if I launch the process via a userform button click, then for some reason the
DisplayFullscreen = False, Sheets hiding, and save codes have no effect (fullscreen persists, sheets are not hidden, no file is saved) in the Workbook_BeforeClose() subroutine....

I repeat: all the above works fine if process was launched by "native" excel button, but does not have any effect if launched from a userform commandbutton. (?!?!) any ideas what's going on?

I'm including my code so you can get an idea how it's structured.... by it's pretty "by the forum" as far as I can tell...

Private Sub CloseButton_Click()
If(1) Then
'Method 1 - close directly from userform command button
With ThisWorkbook
'.RunAutoMacros (xlAutoClose)
.Close
End With
Else
'Method 2 - set a timer to call a function to perform
' "ThisWorkbook.close" in a function outside of the userform
CustMenuCloseTimer = Now + TimeSerial(0, 0, 2)
Application .OnTime CustMenuCloseTimer, "CustMenu_CloseAction"
End If

End Sub

View 3 Replies View Related

Macro To Copy Dynamic Sheet In New Workbook - Save As Temp / Mail And Delete

Sep 15, 2014

Code to copy the sheet that get selected by if-then-elseif statement and paste in a new workbook, save the workbook as temp, email it and delete it,

sub sending_mail

Dim OutApp As Object
Dim OutMail As Object
Dim rng As Range
Dim DataWB As Worksheet

[Code] ......

View 2 Replies View Related

Delete All Sheets Except One

Nov 25, 2009

I want to delete all sheets except for one named "Start"

View 3 Replies View Related

Delete Row In All Sheets

Mar 6, 2012

I need to delete Row 1 of all on all open sheets in a workbook(meaning that hidden sheets should not be affected).

View 1 Replies View Related

Delete Some Of The Sheets?

Apr 30, 2013

code that would read the current spreadsheet names of the workbook and then delete some of those sheets.For example the current sheet names are:

Input
Budget12
Budget13
Sheet4
Sheet5
Sheet6

The code needs to delete all the sheets other than the following: Input, Budget12, Budget13. if the code could ignore sheet name that contains text "Budget" rather than ignoring Budget12 and Budget13. That would make it more dynamic.

View 2 Replies View Related

Delete (2) From Sheets Name

Apr 6, 2009

How sould I remove (2) from sheets names

Like sheet1(2) change into sheet1

View 9 Replies View Related

Delete All (except One) Sheets

Jun 2, 2009

I would like to delete all except one sheets in the workbook by pressing onto a button. So I wrote the folllowing code (its obviously only a part)

Application.DisplayAlerts = False
For Each Worksheet In Worksheets
If (Worksheet.Name "Instructions") Then
Worksheet.Delete
End If
Next
Application.DisplayAlerts = True

and put it into a Module in the same workbook. The button itself is in one of the sheets to be deleted, so I assign a simple macro to it which is just calling the code above.

Well, sounds simple, but it does not work, with "Subscript out of range" error at the attempt to delete one (not the first one) of the sheets.

Searching around suggested that the problem appears when the worksheet I try to access does not exist (missspelling of a name or so). but in my code I dont really use it.

View 9 Replies View Related

VB Code To Add And Delete Row From Sheets

Mar 27, 2014

I would like to add 2 buttons to each page. One button to add a row at the bottom of the table while keeping all of the same formatting and another button to Delete a selected row from the table. So that if there is more assignments than allowed in the current table, a row could easily be added.

I would think that the code for the class sheets would all be the same.

The other obstacle I thought about is possible making a button on the Summary page that would add another sheet, call it Class and whatever number comes next and also add it to the summary table with the same formatting (including the hyperlink that's in the Classes column where it will take you to the Class sheet that you want to drill down to).

I have attached the file. If the summary sheet is took much work it's not a big deal, I would be fine with just being able to have 2 buttons on the class sheets that allowed them to add and remove and such.

I would also like to contribute. I know a decent amount about SQL and SSRS/SSIS Reporting services.

I also need it to be able to unprotect my worksheet and then protect it back, Since I will only want them to be able to type in the areas I specify. I also moved the summary at the bottom of each class sheet to the right side at the top so its easier for them to view.

View 5 Replies View Related

Delete 7 Cells On Each Of The 35 Sheets

Aug 12, 2008

i am going to have 25 sheets for subcontractors in a construction magement workbook. i want to delete 7 cells on each of the 35 sheets. they will all be in the same place on all sheets. ex c7 g18 e14 etc on all 25 sheets. i was wondering if there is a way to create a function that can perform this operation.

View 13 Replies View Related







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