Save Column J Of WorkBook When WorkBook Is Not Saved.

May 27, 2006

Need VBA code to save column J of open workbook called LmbcAcctsPayable.xls, Sheet1, to same workbook & sheet called LmbcAcctsPayable.xls, Sheet1, when save is not selected.

Reason: The workbook is usually not saved because it is more of a templet with names in column A. Column J is updated with a date when a row is used so I need the column J to copy automatically to the blank templet when exiting without saving (using ThisWorkbook.Save = True in Auto_Close). That way, rows not being used for a long period of time can be periodically eleminated.

View 3 Replies


ADVERTISEMENT

SaveAs - Copy Sheet Into New Workbook And Save It In Same Folder As Original Workbook

Jun 17, 2014

I have been trying to edit a code which previously saved a copy in a new workbook to a specific folder/path. (Additionally it copies and clears some figures, but this is working as it should.)

However I would like the copy to be saved at the same location as the original workbook, regardless of the path the original workbook is saved.

I.e if I need to move the workbook containing the code to a new folder/location, when using the macro, the new copy should be stored in the same folder/location as the original one.

For now it is only saving the copy into "My Documents"

Code:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 16-02-2009 by ceng
'

Sheets("Bunker ROB").Select
Sheets("Bunker ROB").Copy
ActiveWorkbook.SaveAs Filename:= _
ActiveWorkbook.Path & Range("D3"), _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False

[Code] ........

View 2 Replies View Related

Save Single Sheet To New Workbook And Delete VBA Code From New Workbook

Jun 25, 2014

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")

[code]....

View 2 Replies View Related

Macro To Save As Workbook 2 From Data In A Cell From Workbook 1

Sep 28, 2012

I have two workbooks open. I need to "Save As" and close workbook 2 with a file name from a cell in Workbook 1. The macro is running from workbook 1.

I'm guessing a change in the last line. I don't know what Dim means either.

Dim FName As String
Dim FPath As String

FPath = "G:"
FName = Sheets("sheet 1").Range("A1").Text
ThisWorkbook.SaveAs Filename:=FPath & "" & FName

View 1 Replies View Related

Execute When Workbook Saved

Oct 15, 2009

I would like to execute a sub when the workbook is saved, what is the procedure for this.

View 3 Replies View Related

Activating New Workbook That Hasn't Been Saved As Yet

Apr 3, 2014

I am busy with code that filters and copies from a "source file" using dialogue to choose criteria than adds a workbook and pastes filtered information. I than go back to "source file" and do second filter. My question is this newly added workbook changed from book1 to book2 etc everytime the user will run the macro. How do I go about activating the workbook for second and third paste without it being saved?

Here is name code:

[B]Workbooks.Open ("C:Documents and Settingsabek276DesktopSource File.xlsx")

Options = InputBox(Prompt:="Scheme Code", Title:="Options")
Options1 = InputBox(Prompt:="Scheme Code", Title:="Options")
Options2 = InputBox(Prompt:="Scheme Code", Title:="Options")

[Code].....

View 7 Replies View Related

Unprotect A Workbook With VBA And Re-protect It When Saved

May 13, 2008

I want the excel spreadsheet to "BE Protected" in standard form, and only be "Unprotected" when macros are enabled -- BUT DONT JUMP TO CONCLUSIONS, hear me out, it gets deeper than that

If the user does not enable macros, I want the book to be protected. If they do enable macros, it becomes unprotected.... (On load is good enough, no need to be real-time)..... But, they can save the book, so it would no longer be protected , which is where my question comes in ...

I could use the -unprotect "password"- on load when macros are enabled but this will only work if the spreadsheet was originally protected and is never saved again. This is a problem because this workbook will be given to others and will be saved time and time again.

So, I had a vision :-) .... function 'before save' , protect the sheet using -protect "password"- , allow the sheet to save, and then unprotect back using 'unprotect "password"' so you can continue using - BUT, the problem with this is now I have created an endless loop in theory, because after it unprotects it would want to re-save again because it changed

View 12 Replies View Related

Macro To Show That Workbook Has Been Saved

Nov 25, 2009

I have a workbook that I constantly am improving with new macros and VB routines. I sometimes have two versions available for use at the same time. I would like to create a macro or routine that will tell me if the workbook has been saved. A simple cell color change to indicate I've saved would be fine. Also, if I DO save the file and the cell color changes to indicate I have saved, I would like the cell color to change back if any change is made to the workbook. This way I will always know if I need to save or not to keep latest changes.

View 3 Replies View Related

Delete A Range When Workbook Is Saved

Nov 15, 2011

I currently have the code below that closes all but 1 sheet in my workbook called Main

Is there anyway i can clear a range of cells on a couple of sheets within the workbook when save is pressed?

Code:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
For a = 1 To Sheets.Count
If Sheets(a).Name "Main" Then Sheets(a).Visible = 2
Next a
End Sub

View 4 Replies View Related

Determine Last Saved Date Of Workbook

Sep 7, 2007

I am looking for a macro that will run on worksheet activation. it needs to run only if the file had been saved from the previous week. would something like this work?

Private Sub Worksheet_Activate()
If application.worksheet.lastsaved = msolastweek Then
range("RANGE").clearcontents
End If
End Sub

View 7 Replies View Related

Conflicting Saved Changes In Shared Workbook

Apr 25, 2008

I've designed a performance indicator (PI) recorder for up to 12 users, it has a userform allowing the users to input their data and a button to save the data and unload the user form. the data is saved using the following

Dim NextRow As Integer
On Error Resume Next 'skips line if workbook is not open
ActiveWorkbook. Sheets("DATA").Activate 'sets the "data" worksheets as active
NextRow = Worksheets("DATA"). Range("A" & Rows.Count).End(xlUp).Row + 1 ' finds the next empty row
With Worksheets("DATA").Range("A" & NextRow) 'inserts the data from the user form
there follows a series of offsets to slot the data into the correct column,
then this code to save the workbook
ActiveWorkbook.Sheets("reports").Activate
Application.DisplayAlerts = False ' suppress overwrite warning message
ActiveWorkbook.SaveAs "MY PATH"
CreateBackup=False
Application.DisplayAlerts = True
MsgBox "Spread sheet Saved"

The problem I'm having is that when the user then closes the excel application there is a conflict between the users 'saves' i.e. one ultimately will overwrite the other. is there a way round this ?? (this is in EXCEL 2000)

View 2 Replies View Related

Open Workbook Then Save As Different Workbook Dependant On A1

Feb 14, 2009

is it possible to work on a workbook lets call it 123

once macro button is pressed it opens workbook abc

then saves it as what ever is in cell a1 to a directory?

View 14 Replies View Related

Save Workbook As Macro Enabled Workbook By VBA

Jan 23, 2012

the following scenario.

I am using the following code to save a workbook as a macro enable workbook on the selected path as today's date. But it is being saved as a macro free workbook.

Below is the code in module:

Sub save_file()
Dim tDate As String
Dim FileSaveName As String
Dim fPath As String
tDate = VBA.Format(DateSerial(Year(Date), Month(Date), Day(Date)), "dd-mm-yyyy")
'FileSaveName = Application.GetSaveAsFilename(InitialFileName:=tDate, filefilter:="Excel Files(*.xlsm),*.xlsm", Title:="Please save the file")

[Code]...

View 4 Replies View Related

Save Data From One Workbook To Another Without Opening Workbook

Mar 1, 2013

I have a spreadsheet that data gets exported to from a software program. There is information such as customer name, part number, inquiry number, etc that I'd like to use to develop a log of all my estimates I create for parts. I'd like excel to take the cells I select and insert them into certain cells in the other workbook and automatically save that workbook. This will create a log of all my estimates where I can then link the full estimate to the log. The information will have to go in the next available row. Is there any way I can accomplish this without having to open the other workbook and save the work book each time?

View 1 Replies View Related

Delete All Hidden Worksheets When Workbook Saved

Oct 15, 2008

I have working code to unhide specific worksheets from a large number of hidden worksheets and would like to be able to delete all the hidden sheets when the workbook is saved or maybe have a button to delete all the hidden (un-needed) worksheets beside the selection drop-down menu, so that only the selected sheets are saved.

View 4 Replies View Related

Disable Macro In Workbook Open When Saved

Nov 17, 2011

I have a macro in a workbook template,that when the workbook is open it populates a cell with the date and time such as 111711.507. This becomes the contract number for this workbook.. They complete the form or workbook and save it. The next time they open the saved workbook the macro runs and changes the contract number to a new number. I want to disable the macro on the saved workbook from changing the number.

View 2 Replies View Related

Paste Worksheet To Exisiting Saved Workbook

Jan 8, 2007

I have one workbook named "Data Master" with numerous worksheets... all sheets are named with the following 6 digit format, eg. 005001, 005024, 005133, 005456, 005763, etc.

I have another directory with files each beginning with the particular 6 digit cost centre number.

I was hoping to have a macro that will... for each worksheet in "Data Master" check a specified directory containing the cost centre files, for the file beginning with the relevant worksheet's 6 digit cost centre number... and simply paste a copy of the worksheet in "Data Master" to the end of the existing sheets in the cost centre file.

View 9 Replies View Related

Show UserForm If Template Saved As Workbook .xls

May 12, 2008

I have created a template with a form. Now I'm using (the code is in ThisWorkbook)

Sub Workbook_Open()
frmMyForm.show
End Sub

This runs the form also when opening the template or a saved workbook based on the template. I want the form to run only when creating a new workbook based on the template. How do I do?

View 3 Replies View Related

Opening Saved File Also Opens Blank Workbook

May 3, 2013

When I open any saved Excel file the saved file opens along with a blank workbook titled "Book 1". How can I make it so when I open any saved Excel file it only opens the file I want and not a new workbook every time?

View 2 Replies View Related

VBA Save Workbook As Shared Workbook

Aug 30, 2012

HTML Code:

Private Sub SaveAsAndShare()
ActiveWorkbook.SaveAs Filename:= _
"S:LdnPath1Path2Path32012Folder1Folder 2Aug12ReportName " & Format(Date, "MM-DD") & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
End Sub

HTML Code:

ActiveWorkbook.SaveAs FileName, , , , , , xlShared

My code is the first bit, the 2nd code I found from another post, I want to add xlshared to my code above so it is shared when saved down.

View 4 Replies View Related

Save Workbook On Workbook Close

Aug 26, 2006

I snagged this code out from another project I wrote, and it works fine in that one, but doesn't in the new project.

What I want, is when the person presses the exit button, it will save whatever was done, its running as a form printer and database. The code below is the code for my exit button.

Private Sub CommandButton4_Click()
Dim sAnswer As String
Dim i As Integer

' ****************
' ** Exit Button**
' ****************

When it gets to "If ActiveWorkbook.Saved = False Then" it does put the question out "Do you want to save changes" I click Yes and it doesn't save it.. I have tried both activeworkbook and thisworkbook ... I copied the code and verified all is good to go..

View 9 Replies View Related

Creating A Log That Logs The Last User That Saved The Workbook Including The Date And Time

Mar 16, 2004

Is there any way of creating a log that logs the last user that saved the workbook including the date and time. I would like the log to be a sheet hidden in the workbook. Not many people will be saving the workbook.

View 9 Replies View Related

Macro To Save Workbook By Referencing Cell In Another Workbook For File Name And File Path

Mar 21, 2013

I have got a master workbook and I have written macro to copy and paste data on another workbook. write a macro to save the new workbook to a file path with a file name where both file name and path are stored in master workbook sheet...

View 5 Replies View Related

Excel 2003 :: Unable To Allow Users To Make Changes To Workbook But Only Be Able To Do Save As Not Save

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

Macro To Check If Saved Then Save Else Bring Up Save As Dialog

Sep 6, 2012

I'm trying to make a macro check if a file has been saved (ever). If so I want the macro to do a regular save (with already esatablished filename and location) before it proceeds with the rest of the macro. If the file hasnt been saved (if it runs from a new workbook) then I want it to pop up the save.as dialog, so that the user can choose the name and location of the file before the macro continues .

The macro itself is saved in personal.xlsx.

View 1 Replies View Related

Command Button To Copy Row Of Data From One Workbook To Column In Another Workbook

Jul 24, 2013

I would like to use a command button to copy a row of data from one workbook to a column in another workbook. The row of data will have different values on a daily basis but will always be B2 through BE2. I would like the copied row of data pasted in the next available column to the left in the other work book.

View 3 Replies View Related

Populate Cell In Workbook 1 If Column B Value If Present In Workbook 2

Feb 15, 2013

Here is the scenario: I have workbook called Leads_2013-0215 it has about 10K records I have workbook called LawFirms it has about 4K records.

If the value in Column I in Leads_2012-0215 is present in column G in LawFirms, I want to add the value Law Firm to column AV in Leads_2012-0215.

View 2 Replies View Related

Save Workbook Using Variable For Save As And For A New Folder Name

Jul 31, 2009

I have figured out how to save the workbook using a variable to saveas but I would like to create a new folder to place the new workbook into. I have tried a few things a am not having any luck. I recorded a macro and the code it produced is as follows.

View 6 Replies View Related

Populate All The Data From Column Of Workbook To Other Workbook

Oct 11, 2005

=IF(ISERROR(INDEX($A$1:$B$10,SMALL(IF($A$1:$A$10=$A$10,ROW($A$1:$A$10)),ROW(1:1)),2)),"",INDEX($A$1: $B$10,SMALL(IF($A$1:$A$10=$A$10,ROW($A$1:$A$10)),ROW(1:1)),2))

I have 10 columns in workbook 1 and i am tryin to populate all the data from
10 columns of workbook 1 in to workbook 2. but the prob is if i use the above
formula, i have to modify it in all the columns of workbook 2 to get the data
from workbook 1. what makes my job easier is if i cld use the above function
or any other to populate all the 10 columns of workbook1 in 10 different
columns of workbook 2 without having to use the formula 10 different times
and modifying it each time. its like writing the function in one cell and all
the 10 cells get populated by itself in workbook 2 with the data from
workbook 1. I used the above function as there are dupluicates in the data
and vlookup dont work in that case.

View 11 Replies View Related

Saving Cell Contents To XML File Saved As Current Workbook File Name

Dec 12, 2012

I have numerous spreadsheets that I need to open and unhide a sheet, that has XML data stored in cell A1. What I need to do is copy that data in cell A1 and paste it into a text document and save that as an XML file saved as the XLS workbook name with a date stamp.

I'm running into many issues, the main issue is the saving as current file name, and the formatting of the text/XML file.

Here is my current code, which doesn't reference the current file name and is just very generic. Once I get the saving as file-name correct and the formatting of the xml file correct, I will work on it a bit more.

Code:
Sub Test()
Dim Rng As Range
Dim wb As Workbook
Set Rng = Range("A1:A2")
Set wb = Workbooks.Add
With wb
Rng.Copy

[code]....

View 4 Replies View Related







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