Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Excel


Schedule Macros To Run While Workbook Is Closed

I'm trying to look at options for scheduling macros to run at a particular time. Ideally I would like to run one at 3:00 am during every week night. From what I've looked into, I can run the OnTime procedure and it could schedule this to run each night. Does anyone know if this is correct, and if there are any other options avaliable to me?

Also, does anyone know if this can run automatically if Excel is closed, or does Excel have to be open? Does the workbook have to be open?

View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
Copy Range From Closed File & Paste To Closed Workbook
Is there code that will take certain data from one Excel sheet to another named file in a different place on the network? Example Copy cell aa47 from "Recent Faxes.xls" that sits in "correspondence" folder. Then paste into cell B25 "Current Documentation.xls" in the "Sales Contacts" folder

View Replies!   View Related
Schedule Workbook Open Automatically
Is there anyway I can schedule an excel workbook to open up at a certain time; I have some code attached to the Workbook Open function; so when the workbook is opened the code will run; but I need the workbook to automatically open at say 17:00 everyday so the code can run.

View Replies!   View Related
Transfer Data From Open Workbook To Closed Workbook
im looking for some code to transfer cells a3,d6,f9,i6,k10 and i18 from open workbook named "hello"


closed workbook named "goodbye" and input to next available row
a3 to a1
d6 to a2
f9 to a3
i6 to a4
k10 to a5
i18 to a6

View Replies!   View Related
Copy From Closed Workbook Then Create New Workbook
I've got a problem with this code, have been wracking my brains about. Here is the process I am trying to do:

1) Copy a range (a2:av1000) but (ideally) find the last populated row from a closed workbook (with a different password)
2) Create a new workbook and paste this data into it at A2
3) Close all the workbooks but only save the new one.

View Replies!   View Related
Copy From Closed Workbook To Open Workbook
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 Replies!   View Related
Pull Value From Closed Workbook Where Workbook Name Is In A Cell
I want to open an excel file whose name is a value in a spreadsheet, and then pull a value from the spreadsheet I queried into my existing workbook. Here is the syntax i have so far:

to note: I'm calling the workbook in which the macro is located testproject.xls, and I'm using [integer].xls as my list of files that the macro will query. Ultimately, this code will go in a loop.

Set currentCell = Worksheets("Sheet1").Range("A1")
varCellvalue = currentCell.value
Workbooks.Open "path_of_file" & varCellvalue & ".xls"
ActiveCell.FormulaR1C1 = "=[3.xls]Sheet1!R1C1"

The problem is, I want [3.xls] to carry the sale value as varCellvalue with .xls appended, and not be kept static at 3. I tried inserting & varCellvalue & ".xls" into the brackets, but with no luck. My only difficulty is getting [3.xls] to vary along with varCellvalue.

View Replies!   View Related
How To Delete Another WorkBook Macros Using Macros
What is the commands or script for deleting a macro automatically using
another workbook macro.

View Replies!   View Related
Sum In A Closed Workbook With VBA
I was wondering if there's any way to sum inside a closed workbook by usin' VBA? I think I figured out how to do it just with formulas, but I was hoping to be able to make like a macro or something to do it, 'cause its kind of time consuming having to go back and forth to all these workbooks.

View Replies!   View Related
Max Value From Closed Workbook
Is there a formula or vba code that would allow me to get the max value from a column in a closed file/workbook?

View Replies!   View Related
GetValue From Closed Workbook
when using the Active X Data Objects 2.8 Reference in excel 2007, i run into the problem with the GetValue function. After running the script the output sheet shows #REF! in all specified cells?!

Sub test12()
p = Location
f = file
s = "Sheet1"
For r = 1 To 150
For c = 1 To 12
a = Cells(r, c).Address
Sheets("Cars").Cells(r, c).Value = GetValue(p, f, s, a)
Next c
Next r
End Sub..........

View Replies!   View Related
COUNTIF On A Closed Workbook
I have the a COUNTIF function used on one workbook which refers to another workbook, however I get the result #value! unless the other workbook is open - this is even if I chose to update links when I fist open the file.

Do all workbooks have to be open when using COUNTIF?

If I open the other workbook after my workbook with the COUNTIFs on has been opened then all #value! errors disappear and the correwct info is shown.

View Replies!   View Related
Lookup Value From Closed Workbook.
I have a workbook called Book1 that was created from another macro. I am attempting to do a lookup using columns B2 and C2 and look for the same values in columns G6 and J6 from a workbook called Marine Moves..If a match is found copy the value from Column H insert that value into Book1 Column A, if possible I would like the Marine Moves workbook to remain closed during this process.

View Replies!   View Related
Referring To Closed Workbook
I have the following formula to extract a specific cell from a closed workbook. It works fine. I want to be able to make the file name refer to a another cell so I can create a spinner to change it. For example:

='C:Documents and SettingsTom Desktoplabor[01_032407.xls]Stats'!A4

Cell A1 would be 01_032407, and I would replace [01_032407] with [A1]
but it does not work.

View Replies!   View Related
Prevent Workbook Being Closed
I display a message box in Workbook before Close event.
If user click yes I shouldnt close the workbook if NO i should close the workbook.

In the Yes part, How can I stop excel from closing the workbook.
If i dont write any ocde it automatically closes in the event.

View Replies!   View Related
Getting Data From A Closed Workbook
I am trying to use this code to pull data from a closed workbook. The code will be in workbook Book1 and I will be pulling information from closed workbook Book3. I need to pull data from cells A1:A4 from Book3 and place it into Book1 on Sheet2 in cells A1:A4. I receive an "Subscript out of range error" on this line of code

View Replies!   View Related
Pull From Closed Workbook
I have a folder that contains hundreds of excel workbooks. Each workbook has 20 or more sheets. All workbooks have the same look and design. All workbooks have macros that they use to function and the macro I want cannot interfere with their macros.

What I want to do is copy certain cell values (some numeric and some text) from several sheets from these workbooks and paste them into another workbook (a master workbook) that is essentially collecting these values into a table without having to open all these workbooks. For example, let’s say all of the workbooks are named with a numeric value starting with “one.xls” and that the sheets in these workbooks are named “a”, “b”, and so on. So, in the master workbook in cell “B2”, I want the name of the first workbook searched (“one.xls”); then in cell “C2”, I want the value from cell “J45” on sheet “b” of “one.xls”; in cell “D2”, the value from cell “B32” on sheet “b” of “one.xls”; in cell “E2”, the value from cell “K13” on sheet “e” of “one.xls”; in cell “F2”, the value from cell “R43” on sheet “k” of “one.xls”. The in cell “B3” of the master workbook, I want the same information as before except from “two.xls” instead of “one.xls”, and so on down to “three hundred.xls”.

View Replies!   View Related
Retrieving From A Closed Workbook
I have tried to find how to retrieve a worksheet from a closed workbook and I am almost sure that there was an answer how to do this in FAQ but I cannot seem to find it, does anyone know where this thread is?

View Replies!   View Related
Closed Workbook Still Showing In VBE
I and a colleague are working on some code to automate a web page. We've been able to get it to fill in the needed forms, run a report which comes out in Excel format and save the output to a specified shared drive location.

However, when we attempt to close the resulting window we are unable to...

The webpage creates a new Internet explorer window which we're able to capture and do a wb.saveas, but when we do wb.close, it does not generate an error, but the new window does not close.

In the VBE, the workbook is visible as an object, but in Excel if you go to Windows on the main menu and attempt to select it, it's not listed and the Unhide option is greyed out.

So the object is a member of the workbooks collection for the VBE, but not Excel...

View Replies!   View Related
Copy From Closed Workbook
Copy From Closed Workbook

I have been trying this method for a while, I just don't know what to put where, & what names to change.

Trying to pull ranges from database.xls to cost.xls

View Replies!   View Related
Get Values From Closed Workbook
I have a master file with two sheets. I have another input file with only one sheet. Without opening the input file, is it possible to copy the range and paste special values only into a duplicate sheet in the master?

View Replies!   View Related
Values From A Closed Workbook
I wrote here a few days ago about an issue retrieving a closed worksheets values and I got help from RoyUK(see code below and link), but for some reason the values are never entered into the open worksheet.

Retrieving From A Closed Workbook
Sub FillingSheet()
Dim filetoopen As String
Dim wb As Workbook
filetoopen = Application _
. GetOpenFilename("XL Files (*.xls), *.xls")
On Error Resume Next
Set wb = Workbooks.Open(filetoopen, True, True)
With ThisWorkbook.Worksheets(1)
. Cells.Value = wb.Worksheets(1).Cells.Value
End With
wb.Close False
Set wb = Nothing
End Sub

View Replies!   View Related
Make Workbook Code/Macros Unique To Workbook
How is code or functions kept unique to a workbook? for instance i create a few toolbars that are relevant to "work book 1", however when i open another workbook "2" the toolbars do not function properly or are removed by the opening/closing of the work book, similarly other macros seem to struggle with more than one workbbok open at a time.

View Replies!   View Related
Lookup In Closed Workbook Without Opening
I want to lookup data in a closed workbook, that is located on my desktop, without having to open that workbook. I have been trying code as follows, but having problems with the syntax.

View Replies!   View Related
Copy Worksheet From Closed Workbook
I am trying to use a routine that I copied from another thread on this forum, but I get an error message: Runtime error "1004" Copy method of worksheet failed.

View Replies!   View Related
Copy Cells From A Closed Workbook
I have a folder at this location c:documents and settingscharliedesktoplabor

it contains numerous files that have this format 01_Projections with 01 being the store number and it goes from 01 to 20. the word projections is the same on all 20.

I want to access cell A12 on a sheet titled "summary" in all files and have bring over to another workbook without having to open each one. How can I accomplish this?
What if I want to bring back numerous cells from this same sheet and place them in cells in the open workbook?

View Replies!   View Related
Copy Data From Closed Workbook
I have 7 workbooks I would like to copy data from. The data in question is a sheet called "Accident Book" in each of the 7 workbooks.

I know how to copy the data, but how do I reference these 7 closed workbooks ? They are all in the same directory, but these are other files in there that I dont need, so I dont just want to point to the directory.

I have this code from Nimrod but can't get it working.

Sub GetValuesFromAClosedWorkbook(fPath As String, fName As String, sName, cellRange As String)
With ActiveSheet.Range("A65536").End(xlUp)
.FormulaArray = "='" & "\Bls36dc10WorkH&S" & "[" & Central 2004.xls & "]" _
& "Accident Book" & "'!" & range("A6")
.Value = .Value
End With
End Sub

I actually want to copy data from A6:N6 down to the last row entry, then paste this into the next available row in the activesheet. I need to do this from 7 different workbooks.

View Replies!   View Related
Indirect Reference To Closed Workbook
I am writing a formula in cell "B1" in "December 2007 REVISED BY DAN.xlsm" that will reference cell "X1" in a workbook that has not been created yet.

The way I will tell the formula what the name of the workbook will be is by referencing cell "A1" and adding the extension ".xlsx" to it.

Example: ...

View Replies!   View Related
Display Data In Closed Workbook
I have 1 excel workbook open. It is in a common directory with several other excel workbooks which are closed. In the open workbook, I have created a vba macro that completes various tasks - only within the open workbook. I want to modify the macro in the open workbook such that it will specify data to be displayed in the closed workbooks. Then, when the closed workbooks are opened next, the data will reflect what the macro had specified.

View Replies!   View Related
Copy Data To A Closed Workbook
how do i copy the data from cell C1 in the active workbook "name1.xls"
to cell D10 in the closed workbook "name2.xls" in "sheet1" without opening the
closed workbook?

View Replies!   View Related
Update Data On A Closed Workbook
I created a form and the values that it takes are Date, Issue, Name, Team Member and Cause.

I use a Production Support Report (workbook that I don't want open for people to see) and it will have tabs for each month ie; January

how can I without opening Production Support Report grab the values from the form then update the Production support report by finding the months sheet and sticking the values at the last row.

View Replies!   View Related
VBA To Copy Data From A Closed Workbook
I want to add a button to my excel workbook that when pressed allows the user to browse to an excel file, once selected, the macro then looks for a specific sheet with a specific name and then copies some data (not entire sheet) into a sheet in the doc where the button was pressed.

View Replies!   View Related
Importing A Sheet From A Closed Workbook
I found this code on the net, and it works, it DOES import the sheet specified from a closed status, but it adds 0 where there were blank cells.

The worksheets are static, the names will not change, but the information on them varies in # rows but the # of columns depends on the page..

The use of this import is to upgrade the program, by importing the sheets from the old version.

The first part browses for the file, which is good, because it could be stored anywhere and named anything.. I have it set up to "Click to Import"....

Private Sub CommandButton1_Click()

GetValuesFromAClosedWorkbook "C:", "Book1.xls", _
"Personnel", "A:H"

End Sub

This next part does the importing, but it fills all the columns and rows that were blank with 0's and fills all the way down to 65536 thru my column H that I specified that had data above.

Sub GetValuesFromAClosedWorkbook(fPath As String, _
FName As String, sName, cellRange As String)

how this code can be modifed to do the following..

Detect and copy ONLY the used range of the closed workbook.

View Replies!   View Related
Lookup In Closed Workbook Error
Column D = Dates to be used in each of the matches.

Cell C2 = data-validation cell, for choosing the specific Named Range that contains the data to be returned from the closed wb.

VBA code automatically opens the closed data file and then closes it after returning the data to the main file.

find the error in the cell formula (or named range formula) that’s preventing this from working correctly? (see atttached files)

View Replies!   View Related
Moving Data To A Closed Workbook
I have tried to move data from my active WB to a closed one with the following

View Replies!   View Related
Update Only One Worksheet From A Closed Workbook
I have code that links my existing workbook to a closed workbook. It works as planned but it goes to far. In my first workbook, the one containing the code, I may have up to 30 worksheets. If I am on Sheet5 I may need to run the vba code to update cells X:X only on Sheet5 but instead it updates cells X:X on all Sheets in the workbook. How can I keep this from happening?

I have asked this on another forum but it seems to be a difficult thing, perhaps impossible thing to keep from happening.

View Replies!   View Related
Moving Information From A Closed Workbook For Use In Another
I am working with two files, both files have multiple worksheets. File A has a worksheet that is filled out almost entirely by equations. I need to move the information from that worksheet into file B. In file B i will process the information further. Also, I will print it and it has to look exactly the way it does in file A. I want all this to happen automatically so I am looking for some sort of function or script that will perform this task.

View Replies!   View Related
Referring To A Worksheet In A Closed Workbook.
I'm reading data, from specific cells off a closed workbook. When the sheet that needs said cell data is activated, it automatically opens the workbook and references the sheet nessecary. The issue I've come across, is I now need to access another workbook (Easy to open) with 12 sheets 1 for each month, and only read from the worksheet of the actual Month. Kind of lost on how to possibly make this work. I basically need something like: =location/[workbook.xls]worksheet!cell - where worksheet = B12 and B12 =month(today()) and is formatted to MMMM

View Replies!   View Related
Read Some Values From A Closed Workbook
I am trying to read some values from a closed workbook. I use the following code

View Replies!   View Related
Saving Data To A Closed Workbook
i get an excel file with dynamic data everyday. is there away i can use a macro on this file to store this dynamic data to a specfic closed workbook and add the data onto the old data in that workbook?

View Replies!   View Related
Assign Value From Closed Workbook Cell
Is it possible to write a macro in Book1 to assign Public Varibles in Book1 to values located in cells in Book2 without first opening Book2. So lets say in Book2, sheet1, cell B2 contains the number 5. I want Public Variable "Number_value" in Book1 to equal the number 5.

View Replies!   View Related
Lookup Range In Closed Workbook
I'm using the following sub (thx Benvolio 2001) to do a vlookup (of A1 in Sheet2) and drop the resulting value ("found") in b1 of sheet2. Here's my question: I'm having trouble modifying the rng to use a closed workbook in another folder i:other folderotherfile.xls. The "Inventory" tab is in otherfile.xls
How can i do this? use the vlookup in a closed workbook somewhere else?

Sub Example_of_Vlookup()
Dim lookFor As Range
Dim rng As Range
Dim found As Variant
Set lookFor = Sheets("Sheet2").Range("A1")
Set rng = Sheets("Inventory").range("A4:D500")
On Error Resume Next
found = Application.Vlookup(lookFor.Value, rng, 4, 0)
Range("b1").value = found
End Sub

View Replies!   View Related
Extracting Data From Closed Workbook
I'm currently facing problem with double for loop in the previous vba ,extracting data from closed book. however, it uses only one for loop to extract all data. I need to extract lots of data from the book and thats why i double looped it to extract more data. however, i can only get the first line of data i can't extract any more data from then on.

Sub RunCodeOnAllXLSFiles()
Dim lCount As Long
Dim wbResults As Workbook
Dim wbCodeBook As Workbook
Dim rCell As Range
Dim lCount2 As Long


Application. ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False

View Replies!   View Related
Referencing Ranges In Workbook That Is Closed
Is it possible to reference a named range in a workbook that is not active, one that has been closed but still available within a directory. This closed workbook has named ranges that are being added to from time to time so the named range is growing.

This workbook is to be use as a master list of all data that will be used for validation, VLOOKUPS and what ever other types of referencing I may need in other workbooks which are ALL created from the ONE template, so each workbook will be setup exactly the same, but NOT the MASTER LIST OF DATA.

If it is possible I'll definately need help with code.

Regarding the Template I'm using, I'd like to add a new sheet and have the functionality of buttons and drop down boxes to access saved workbooks (which will all be in the same directory) and also the ability to create a new workbook from my template by perhaps using a button.

View Replies!   View Related
Pull Cell Value From Closed Workbook
it is possible to get a range value from a worksheet without having to open the workbook. I have being trying for a long time to try and work out some code to do the good but have failed miserably. Please find below my latest attempt

Option Explicit

Sub ValuationDataExtraction()

Dim shtDataSheet As Worksheet
Dim strMfolder As String
Dim rngBrokerName As Range

Set shtDataSheet = Worksheets("Data Sheet")

strMfolder = "RD: PEP data files:PEP valuations:PEP 13200s:13235.worksheets(5th Apr 08)"

Set rngBrokerName = strMfolder.Range("brokerName")
shtDataSheet.Range("b65536").End(xlUp).Offset(1, 0) = rngBrokerName.Value

MsgBox "Done"

End Sub

View Replies!   View Related
VLOOKUP Closed Workbook Macro
I'm trying to Access data from an XL file without actually opening the file. In an XL spreadsheet I type in a cell: =VLOOKUP("A", 'C:[Book2.xls]Sheet1'!$A$1:$B$10,1) and get an answer without a problem. In VBA, I try the line of

Current = Application.VLookup("A", Range("'C:[Book2.xls]Sheet1'!$A$1:$B$10"), 1)

and get an error that says Method 'Range' of object '_Global' failed

View Replies!   View Related
Import Data From Closed Workbook
What is the best way to import data from another closed workbook? I used the macro recorder and it gives me something like this

ActiveCell.FormulaR1C1 = "='[CASHFLOW.xls]Sheet1'!R66C5"

I don't think this is the best way, since it asks me to update links when I reopen the file.

View Replies!   View Related
Copy Range From Closed Workbook
I put the following codes in the module of Workbook BS. The codes successfully opened the workbook of 2008. Unfortunately, nothing was pasted to Workbook BS of sheet2. let me know any things missing from my codes.

Sub COPY()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim rng As Range
Set wb1 = Workbooks.Open("C:Documents and SettingsuserMy Documents20082008.xls")
Set wb2 = Workbooks.Open("C:Documents and SettingsuserMy Documents2008BS.xls")
wb1.Worksheets("S").rng("B:B").COPY wb2.Worksheets("Sheet2").Range("A:A").End(xlToLeft).Offset(, 1)
End Sub

View Replies!   View Related
Reference Closed Workbook To Activesheet
how to go about or refer me to how exactly you assign a closed workbook to be active. I know this sounds off and its probably the wrong way to word it so here's my problem. I am developing a macro in Visual Basic 2005 using VB. I have a connection string that looks like this:

Private m_sConn4 As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:2005.xls;" & _
"Extended Properties=""Excel 8.0;HDR=YES"""

What I need to do is connect to it and update which I have done successfully, then save it as 2006.xls. Is there some sort of m_sConn4.SaveAs or something of that nature.

View Replies!   View Related
Refering To Cell In Closed Workbook
I'm trying to check if a workbook can be used in some processes later and whithout opening the other workbook. is it possible. i have done this

str_prod_PT = Application. GetOpenFilename
If str_prod_PT <> "FALSE" Then
If Workbooks(str_prod_PT). Sheets(1). Range("A1").Value <> "Ordem" Then
MsgBox "Ficheiro incompativel", vbCritical
TextBox1.Value = str_prod_PT
End If
End If

View Replies!   View Related
Populate Combo From Closed Workbook
I have workbook "Invoice" which has one Combobox. This Combobox1 should takes its data from another workbook /closed/ called Firms. I need it to be closed.
What code i should write and where, so that when i add new firm and close the workbook Firms, so that the new value will be added to the combobox1?

View Replies!   View Related
Copyright © 2005-08, All rights reserved