Making Backup Copy Of Active Workbook While Workbook Is Open

Jun 30, 2014

I run a model in Excel that automatically saves my file every xx iterations. After saving the file I want to make a backup of the file. Tried

[Code] .....

but get a permission denied error message.

I don't want to use .SaveAs as it is a huge file that takes a while to save and SaveAs has a tendency to break links that should not be broken..

View 13 Replies


ADVERTISEMENT

Making Workbook Opened From Other Workbook Active

Nov 20, 2006

I have a workbook that is a formatted report that I need to insert data from a name variable "CSV" file. I have created a macro in this workbook that calls an "Open" dialog for CSV files that I can use to browse to and open the source file. The macro then is supposed to "select all" copy and close the workbook then make the original workbook active and paste the data starting at row 2. The macro "seems" to be working perfectly except when I do the open the macro then makes the original workbook active, selects all copies then wants to close the original workbook. How can I tell the macro that the csv file that I just opened should be the active workbook, baring in mind that the name won't be known before the time it's opened so I can't hardcode the "active. workbook (NAME) "route.

View 9 Replies View Related

Copy Data From Open File To Current Active Workbook

May 2, 2008

I want to create a standard macro that will copy values from a Master workbook to the current, active workbook I have open. The problem I have run into is when I record a macro it also records the name of the active workbook I'm copying data into and I would like it so when I bring up a workbook I just run the macro and it copies the values in. I'll be doing 8 different macros that each copy different values from the Master spreadsheet

View 8 Replies View Related

Open Workbook, Find Sheet That Contains Cell Value From Active Workbook

Jun 20, 2008

I'm trying to figure out a way to find a specific sheet in a workbook that does not contain the macro. Within the macro I have a cell which holds the name of the specific sheet I would like to find but I can't get it to work for some reason...

'Dim officen As Integer
'Dim thiswb As Workbook

officen = Range("A2").Value
Set thiswb = ActiveWorkbook
' Open the Active Info file
Workbooks.Open "C:My DcoumentsActive 20080616.xls", , , , "xxxxxx"
' Dim sourcewb As Workbook
Set sourcewb = Workbooks.Open"Active 20080616.xls"

Sheets("officen").Select
RowCount = ActiveSheet.UsedRange.Rows.Count
Range("B2").Select.............................

View 8 Replies View Related

Prompt Open Closed Workbook Then Copy Range And Paste Special Into Open Workbook

Apr 6, 2013

I have created a spreadsheet some time ago and have been asked to improve on it but I'm rusty with VBA.

I have an automated ordering system that saves each sent order as the date e.g "05-04-2013.xls" but the management team want a graph with the data for the last 4 weeks compared. I have created a seperate workbook called "consumables report.xls" which has a column with the products listed followed by columns "Quantity" and "cost" which is repeated for the 4 weeks of the month.

I want to add a button to prompt the user to choose the saved order e.g "05-04-2013.xls" (all orders saved in same directory) to copy and paste the quantity and cost columns (c8,D69) into "consumables report.xls". I got this to work earlier but it would only paste the formulas and not the values. So I need

A prompt to open workbook
Copy range (c8,d69)
Close work sheet
Paste special .value (c8,D69)

I dont care if it has to open the workbook to copy the data as this will only be used once a month so it dosnt matter how slow the code is.

week 1 week 2 week 3 week 4
Product
quantity
cost
quantity
cost
cost
quantity
cost

1
2
3
4
5
6
7
8

View 7 Replies View Related

Backup Copy Of Workbook Macro

Nov 28, 2013

I am using this code to create a backup copy of my workbook:

Code:
Sub DOUGHMON()Dim fname
fname = "C:UsersAndrewDesktopWEEKLY SALES REPORTS" & Format(Now, "dd mmm yy") & ".xlsm"
ThisWorkbook.SaveAs Filename:=fname
End Sub

The only problem with this code is that my current file gets closed and the backup is open. I'm not sure if that is exactly what happens, but when it is done the current file that is open is the copy, and I would like the original file to stay open.

View 1 Replies View Related

Save Copy / Backup Of Workbook As Date In Certain Folder

Sep 7, 2013

I need to save an excel workbook when a "backup" button is pressed to a folder named "Backups". I want the name to be the "date" (09/07/2013) only and I want it to automatically overwrite anything previously saved for that day.

Book1.xlsm

View 2 Replies View Related

Copy Data From Closed Workbook And Append In Active Workbook?

Feb 6, 2013

I have some vba that opens a closed workbook, copies data from a named range and then pastes it to the active workbook.

However, what is happening is that the closed workbook is opened and only part of the data is pasted. What I would prefer to happen is this:

Open the closed workbook-->copy the named range-->paste(append) to next empty cell in column B.

Heres the code that I have got.

Sub Workbook_test()Dim wb As Workbook
Application.ScreenUpdating = False ' turn off the screen updating
Set wb = Workbooks.Open("G:WAREHOUSEPlanningSmartNew Training Plan raining plan.xls", True, True)

[Code]....

View 5 Replies View Related

Copy Of Sheet From Specific Workbook To Active Workbook

Mar 6, 2014

My requirement is as follows......

I want to get a copy of worksheet from specific workbook to active work book in which i want a copy of sheet get moved.

View 2 Replies View Related

Copy Of Sheet From Workbook 1 To X Workbook Which Is Currently Active?

Mar 6, 2014

I have a Picture in a workbook kept open. ( workbook 1 )And i have some X workbook open....i want a copy of sheet from workbook 1 To X workbook which is currently active.

View 1 Replies View Related

Copy Worksheets From Active Workbook To A New Workbook

Apr 22, 2009

I am trying to code a Macro so that i can take all the worsheets and save them as individual Workbooks. I wrote a macro that appeared to work, but, after it saves the first sheet as a workbook, i get a debug error.

MS VB Script error:
Runtime error '9':
Subscript out of range

Any advise would be greatly appreciated.

Thank you

Code is below..

Sub saveall()
'
'
For Each ws In ActiveWorkbook.Worksheets

ThisFN = "C:Documents and SettingsUserDesktop" & ws.Name & ".xls"
I = I + 1
Sheets(I).Select
Sheets(I).Move
ActiveWorkbook.SaveAs Filename:= _
ThisFN, FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False

Next ws

End Sub

View 9 Replies View Related

Copy Data From Workbook / Open Existing Workbook - Select Range And Paste

Mar 26, 2012

Copy data from workbook, open existing workbook, select range and paste. But my copied data is lost.

Sub Select_Copy_Paste()
'
'
Windows("ElektroFunctiesDatabase.xlsm").Activate
Sheets("PowerSupply's").Select
Range("A2:I6").Select
Selection.Copy

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

' Here i need to do something to paste data into r.address?

View 4 Replies View Related

Modify Existing Macro To Copy To Different Workbook Instead Of Open Workbook?

Dec 7, 2012

Here's my macro:

Code:
Sub CopyRow()'
'Copies row to new sheet, highlights it, marks column 'A' as copied.
'
Dim cCell As Range
Set cCell = Selection.Cells(1, 1)
Selection.Copy
Sheets("Sheet2").Select
Rows("2:2").Select

[Code] .....

Is it possible to modify it to paste into a different workbook called c:filesDestination.xlsm, instead of the existing workbook (Source.xlsm)? The destination sheet name is the same (Sheet2). It's OK if both workbooks are open at the same time.

View 2 Replies View Related

Close Active Workbook And Open Another

Jan 30, 2008

Two workbooks named"test1.xls"test2.xls

I have a userform in "text1.xls" workbook when I click on commandButton it validates Staff name and Staff number stored in sheet1 of "test1.xls" workbook and opens test2.xls file which is in different folder. Problem is how do I code to close or unload "test1.xls" after opening test2.xls

Private Sub goButton_Click()

F$ = "D: estFiles est2.xls"
' can I use Path so I don't need to type the full directory path

Workbooks.Open Filename:=F$

End Sub

View 5 Replies View Related

Copy From Closed Workbook To Open Workbook

Apr 25, 2007

I'm trying to write a macro that accomplishes the following:

" Book 1" is already open. The user runs a macro that lists all .xls files in directory "d:measurements" The user selects the desired file from the list or box the macro copies from this "book 2" " sheet 3", " range A6:I107 and pastes (values only) into "book 1", "sheet 5", "range A6" End of macro.

I want to accomplish this without opening the selected file (book 2)

View 4 Replies View Related

How To Have Excel File Open In Last Active Window / Workbook

Apr 15, 2013

I compared data between excel worksheets all the time, well recently my computer was upgraded from Windows XP to Windows 7 and since then I have not been able to figure out how to have an Excel file to open in the Excel window selected(or last active window) when I have more than one workbook open. Is there a way to do this?

View 5 Replies View Related

Copy Active Worksheets Into One New Workbook

Jul 3, 2007

I have 16 proposals that are either hidden or visible in a proposal generator. I need to be able to copy only the visible worksheets over to a new workbook that uses a name from a cell inside the proposal generator. Then a save as prompt to force the user to save the file wherever they choose.

View 14 Replies View Related

Save Backup Of Workbook Before Close

Dec 15, 2009

I call the macro below from a Workbook_BeforeClose sub; however, if the user has not saved changes before they hit the close then the Sub SaveFile runs and then after the backup save they are then asked do you want to save changes.

I initially had this sub run with Workbook_BeforeSave, but I don't really want to run this everytime the user selects save.

Any ideas on how to how the save changes first and then the backup?

View 6 Replies View Related

Pull Data From One Closed Workbook Into Active Workbook With Command Button

Feb 27, 2014

I've been using the following code to bring in individual cell values from one closed workbook to an active one. I would like to modify this is possible to bring in multiple cells at once and also pull them into a different worksheet in the active workbook. Basically, my command button is on Sheet1 but I'd like the data to pull into a cell on Sheet2.

Private Sub CommandButton1_Click()
With Range("Q9")
.Formula = "='C:Users[Workbook Name.xlsm]Worksheet Name'! N27"
.Value = .Value
End With

View 6 Replies View Related

Copy Ranges From Closed Files To Active Workbook

Oct 25, 2006

I have a number of files in a directory, with data in columns A:E, and variable rows deep (200-300) that I’d like to copy to the active workbook. I’d like to have a file window open to the same set directory (ie. “CArchives” and be able to select any file in that directory to copy.

Note:
There are 2 separate ranges to copy, which must be done separately because the headings are to be moved 2 columns over - also, there is data in beteen the headings and main data in the active workbook.

Range 1: Two headings cells in A1:B1 get transposed to C1:D1.
Range 2: the files’ data starts at A4 but gets inserted starting at cell A6 of the active workbook.

View 7 Replies View Related

Create Open Copy Of Open Workbook

Jul 30, 2009

Create a full copy of an open workbook (eg. activeworkbook MyFile.xls) using VBA, with the new copy (eg Book1.xls) open as well ,without having to save a copy first then open it ?

View 9 Replies View Related

Make Workbook Open- Open Correct Month Workbook

Jul 8, 2006

I have Monthly sales sheets that import my cash register data into them. I wanted to set them up to do everything without being there. So I have my task manager open excel at 9:30pm everyday and it runs the macro to import the data into the correct day of the month. Here is the workbook

open macro-

Private Sub Workbook_Open()
Dim dTime As Date
dTime = Time
If dTime >= TimeValue("9:30 PM") And _
dTime < TimeValue("9:40 PM") Then
ImportData
End If
End Sub

This is in my July spreadsheet only. So is there a way to make it know which month spreadsheet to open on the 1st of the month? So come August 1st it will automatically open the August workbook and input the data for the first day? By using the date?

View 9 Replies View Related

Open Workbook & Copy To It

Jul 5, 2007

I am trying to write a piece of vb code that opens a workbook and enters some data into it, saves it as a different file name and closes it.

Basically, I have a worksheet with two sheets. One is a list of a few values (order number, description, date), the other has three cells which the user enters the values into, and a command button. When pressed it transfers the data into the table on the first sheet.

I then need it to open a workbook C:/ewr.xls and put these values into this, rename it as ewr180.xls, (where 180 is the order number) and save it

I'm almost there but just cant seem to get the values into it

I know i must be missing something so simple, any help would be much appreciated.

Private Sub createEWR_Click()
Dim ewnnum As Integer
Dim descr As String
Dim ewndate As String

' enter new row with data

View 3 Replies View Related

File Backup To Different Folder Location Automatically Whenever Workbook Closed

Feb 10, 2014

1. A workbook is closed

2. In addition to the original workbook being saved, a copy of the workbook with the current date is also saved to the specified location of my choice.

For example

"C:UsersUSER1DesktopBackup Test as of 02-10-14"

3. If a copy of the workbook is already saved with today's date, then overwrite it automatically without prompting the user.

4. All the above happens without any user interaction.

View 8 Replies View Related

Transfer Value From Active Worksheet In One Workbook To Another Workbook?

May 9, 2014

I am trying to transfer a value from the active worksheet in one workbook to another workbook. I keep getting a subscript out of range error on the line that uses activeworksheet command when I run my code.

View 3 Replies View Related

Save A Copy Of The Open Workbook

Dec 4, 2009

I know that the line in my code Worksheets.Copy is NOT what I need to have to make this work, but with it it's the closest I could get to what I want.

I want the user to be able to click the SAVE command button, be allowed to either accept or change the default save options, save the current workbook and then go right back to the form that has the SAVE command button. Sounds simple, I know, but when you don't know the right commands to save the WORKBOOK, not just the WORKSHEETS, it becomes a P.I.A.

I know there's a lot there, but here's my code, which is just a slightly altered version of the code by Ron de Bruin:

Private Sub SaveData_Click()

'If no date has been selected then don't allow SAVE
If PubDateLabel.Caption = "" Then

MsgBox "Publication Date not set. You must select a date before saving.", vbCritical, "No Publication Date!"
Exit Sub

End If

View 9 Replies View Related

Copy Of Active Workbook Path Stamped Onto Spreadsheet With Date And Time / Edit Check

Feb 1, 2010

1) I need to add an edit check
2) have a copy of Active Workbook Path stamped onto spreadsheet with date and time to create a visual record of where the file has been saved (described after the code below).

1) I need to verify that two cells (S7 and S9) are not blank before running my code below (=IF(OR(S7<>"",S9<>""),RUN CODE,"You must select your Provider or Division before you can save this document")).

- If both of these cells are blank a message box should notify the user that they must select the provider and/or division before they can continue with the save.

- If one or more of these cells are not blank the code below should run.

View 3 Replies View Related

Copy In One Workbook And Paste To Another Whether Closed Or Open?

Mar 4, 2014

I would like to copy all the items below the ITEM row and paste it to cell A2 of another saved workbook (say, Saved.xls).

If Saved.xls is closed, the macro would open it and paste. If it is open then it will just paste.

View 1 Replies View Related

Open 2 Workbooks Then Copy A Sheet From 1 Workbook To Another?

May 11, 2012

I'm trying to do something which I believe is simple but my lack of VBA knowledge is getting in the way. How do I open 2 workbooks then copy a sheet from 1 workbook to another?

I can get the workbooks open just can't copy the sheet across? I get a run time error 9, subscript out of range message on copy sheets code

Code:

Private Sub CommandButton1_Click()
'locate file via range and open the document'

[Code]......

View 2 Replies View Related

Copy+paste From Closed To Open Workbook

Aug 11, 2007

how to go about taking data from a closed workbook with a range say A1 to A100, and place it in the work book i have open. I have 3 different sheets in the open work book but all the data is coming from the one sheet in the closed workbook.

View 9 Replies View Related







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