How To Keep Excel From Running A Macro From Another Open Book

Feb 28, 2009

I have several similar documents open. They each have a macro with the shortcut CTRL + SHFT + T. The problem is each macro is different for each book. When I am working on book X, I don't want macro from book Z to run, but it does.

I need all of them to be open.

View 9 Replies


ADVERTISEMENT

Running Macro On All Worksheets In A Book

Oct 7, 2007

I have a macro that I would like to run on every worksheet in my book (over 100 sheets wide). As it takes about 20 secs to run on each sheet, and I don't want to click from sheet to sheet, how can I make it run on every sheet in the book? And no, they aren't named sequentially, either alphabetically or numerically.

is there a function in Excel to return the number of sheets in a book?

View 9 Replies View Related

Macro To Highlight Cell A1 Every Monday Only Once When Open Book For First Time

May 20, 2013

Macro to highlight a cell A1 every monday ( or any day) when we open the book for the first time.

Macro should not run when we open the book from the next time till that week gets over and again it should run once the next week started.

View 1 Replies View Related

Macro (attached To ActiveX List Box) Running On Open?

Mar 26, 2012

I have a spreadsheet with multiple brands on it, and I've added an ActiveX listbox that allows you to select which brands you want to view (Brand A, Brand B, or "all brands"). It works great, however it appears that my macros are running on workbook open.

None of my macros (and there are several) have the "Workbook_Open" code in them, so I'm not sure what's going on?

It really doesn't do any harm, except that someone opening the workbook has to watch excel flash and blink and go through all of these steps/calculations evertime you open it.

I thought Excel might be treating the "workbook open" as me making a selection on one of my listboxes (even if it was already selected) and thus running that macro, but the same thing happens even if I save the workook to display a sheet that doesn't have a listbox.

ETA: From what I've read, activeX controls are always autoloaded when a workbook containing them opens. That's unfortunate. Am I out of luck here for a speedy workbook open?

View 6 Replies View Related

Call Macro In Book Two From Book One

Aug 29, 2007

i have done a search on this topic and found many similar answers to many similar questions. All specify using Application.Run "workbookname.xls!macroname".

In my code, the filename has an assigned value as the master code goes out to many secondary files - the user selects the particular one they want at the start of the macro. The variable assigned is called "UpdateKAMsFile".

how do i get the macro called KAMsRandomColour to run in the workbook designated by UpdateKAMsFile?

View 9 Replies View Related

Get Open A Work Book

Aug 21, 2009

how to get excel to open a work book in my c drive if i have given it the location in cell m2

eg: the cell is M2
C:AVERAGE PRICE (update 2009) 240809

i need the macro to open this workbook when i click the button in the workbook i have open that has the above in cell M2

View 3 Replies View Related

Macro To Highlight Data Inside Other Data Or Move From Book To Book

Jul 16, 2014

so to start off im not able to attach things due to security reasons, what i need is either 1 of 2 macros. if its possible, both are related. one possible is as follows: i need it to go through a certain column (say I for example) and look at the information in it, this information can vary from peoples names along with dates and other stuff, i want it to look through these and if anything has a date today and prior i need the cell to be highlighted. problem is sometimes it might have 2 dates, or no dates. it should have todays date, their name, other information, and future date of something. but not everyone does, this is the macro i dont think that can exists.

2nd macro possibility the other macro uses the first sheet, AFTER been highlighted, normally by hand, and takes it to another workbook and puts in in certain spots. so the first sheet has names of everyone in column K. what i need is it to look at column I and if its highlighted take entire row to other book, and put into sheet under the person name in their tab. the second book has a tab for each person (at this time 18 tabs) which can fluxuate, and each tab is the persons first and last name, without spaces. since when i put sums on main page it didnt want to work with the spaces i had to omit them. again im not sure this is possible.

View 6 Replies View Related

Activating Open Book - Subscript Out Of Range Error?

May 20, 2012

The code opens the book but the activation line gets a subscript out of range error.

Code:
Workbooks.Open File
Workbooks(File).Worksheet("Disc_Nodes").Activate

View 1 Replies View Related

Excel Crashes Erratically After Running A Macro?

Mar 20, 2014

I have developed a model for a client which keeps crashing after being used a few times. The crash is major! Excel shuts down and asks to send an error report.

This can happen after being run anywhere from 3 to 20 times. (Clicking a POST button which transfers items to a "database" type sheet).

I developed the model on a PC using Excel 2010. When this was loaded on a Mac, the user tells me that it happened periodically, and I have seen is occasionally on my PC as well.

However, the workbook has now been loaded on a server, with users across the state of Victoria accessing via Sharepoint - most using Excel 2007. Now it is happening very frequently.

I don't think the macro is at fault, it doesn't go into debug. Excel just seems to GIVE UP.

Have you seen this kind of thing before? Is there a way of "flushing buffers" or something so that Excel can keep working?

I am reluctant to post the model because it is full of personnel details, and is 2.5mb.

View 6 Replies View Related

Running An Excel Macro Using VBA Code In Ms Access

Nov 13, 2006

I am attempting to run a MS Ecel macro that is stored on a MS Excel shared file in a MS Ecel target file (locally stored on my C drive) from a VBA module in Ms Access. That is, from a code i want to open the .xls file that houses the macro, and then open the .xls file that i want to run the file in, and then run the macro.

Here is my situation: the file that houses the macro has the workbook hidden and causes in error.

if i unhide the workbook i get a Run-Time Error 91...object variable or With block variable not set.

if i hide the workbook the vba coding can't find the macro...run time error 1004

once again, i currently have an excel file that houses macro whose workbook is hidden.

does anyone know how this can be accomplished?

here is the ....

View 9 Replies View Related

Excel 2013 :: Enabling Undo After Running A Macro?

Mar 18, 2014

A coworker just ran something by me that i'm quite frankly baffled by. After running a macro, the undo function becomes disabled up to the point of when the macro was ran. I've done a quick search through the forums and can't seem to find this question so i thought i'd ask.

Is there an option to toggle somewhere or 3rd party addon that keeps Undo enabled after running a macro? On a similar topic for my own curiosity, what's the reason that it disables?

View 3 Replies View Related

Excel 2007 :: Running Macro From Protected Workbook

Mar 13, 2008

I have a macro with "ActiveWorkbook.Protect Password:="password"" . It was working fine in excel 2003. In excel 2007, because of this I am not able to run any macro's in the workbook. I am getting a message "The macro may not be available in this workbook or all macros may be disabled. I can see a security warning in message bar saying macros have been disabled, but I dont have have a option to enable the macros.

View 9 Replies View Related

Excel 2007 :: Running Second Macro Causes Formatting To Be Lost

Feb 3, 2013

Running Windows 7, Office/Excel 2007

I have a macro which performs some conditional formatting on a worksheet. Based on the value in cells in one column, if the value meets the criteria some simple formatting is performed (row is colored, font changes for that row etc).

The macro then calls a second macro which performs the same evaluation on the same cells from the same column. If the value meets the criteria (same as previously) it is supposed to change the value of the cell by 1/2.

Both macros work, however the 2nd macro also seems to remove all of the formatting, font changes, coloring etc that occurred from the first macro. I have had the first macro save the active workbook and close and have the 2nd macro re-open the file but it sill overwrites the formatting. If I do not have the 2nd macro run the format changes are saved. I have tried saving the file after the first macro runs with .xls and .xlsx extension and no luck.

View 3 Replies View Related

Restore Excel Undo History After Running Macro?

Jun 11, 2014

I managed to implement a macro that adds a time/date stamp in Column A when any of the subsequent cells in that row are changed. With this now working, I really need the ability to restore the undo history in case a change to the data needs to be reverted.

Sub procedure:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
Application.EnableEvents = False
For Each c In Target
If c.Column > 1 And c.Column < 21 Then
Cells(c.Row, 1) = Now
End If
Next c
Application.EnableEvents = True
End Sub

View 2 Replies View Related

Excel 2010 :: Current Macros Not Running When Recording A New Macro?

Apr 6, 2013

I have a workbook with numerous macros in it and they are assigned to buttons in the different worksheets. I am trying to record a new macro and when I start recording and click on one of the other macros nothing happens. This wasn't a problem in excel 2003.

View 2 Replies View Related

Excel Instance Doesn't Close When Running Macro From Script

Jul 8, 2014

I have a VBS script that runs a macro in a workbook that is located in a SharePoint doc lib. The code looks like this:

[Code]....

I use code exactly like this to run other queries and it works great, but for some reason when I run this macro the instance of Excel doesn't end after the script is done running. I can see EXCEL.EXE sitting in the Task Manager and I have to end it manually.

Here is the code for the macro and related macros:

This macro just calls my other macros. Each terrslicersXX macro is a different sales territory for which there are slicers to filter out data.

[Code]....

An example of one of the sales territory slicers. Basically it just sets the slicer for the required sales territory so the SaveAsWebpage macro can save the information off as a webpage.

[Code]....

Saves the current data as a webpage.

[Code] ....

I have a feeling it has something to do with the last macro and how I publish the sheet as a webpage but I still can't get it to work.

View 8 Replies View Related

Verify That SSIS Package Ran Successfully After Running VBA Macro From Excel?

Jan 7, 2014

I have an Excel VBA macro which calls a stored procedure. The stored procedure calls a SQL agent, which in turn calls an SSIS package. All I need from the Excel VBA code is to ensure that the SSIS package ran successfully. How do you develop a VBA code to let the user know that the job either failed or succeeded after the user executes the Excel macro? Also, is there a need for a recordset in the VBA code?

View 2 Replies View Related

Excel 2007 :: RunTime Error When Running Macro From Alternative PC

Aug 9, 2012

I am getting a "Run time error 5", "invalid procedure call or arguement" when I run a macro on a PC other tha the one on which it was created.

In this case both PC's are running on the version 2007 of Excel.

This is the highlighted statement when the macro fails

Code:
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"SOCX25!R1C1:R" & Lr & "C23", Version:=xlPivotTableVersion14).CreatePivotTable _
TableDestination:="SOCX25!R7C25", TableName:="PivotTable1", DefaultVersion _
:=xlPivotTableVersion14

View 4 Replies View Related

Excel 2010 :: OnTime Macro Stops Running When Window Minimized

Dec 12, 2013

I am using Excel2010.

My sheet displays values collected from a database via an AddIn. The values are updated by pressing CTRL+G (AddIn function).

I have an OnTime macro running SendKeys "^G" to update the values every minute. When the values exceed a certain limit, a sound is played from a custom Alarm function.

This all works as long as the excel window is active.

But if excel is minimized or another window is opened, the values stop updating until Excel is active again.

When the values dont update the sound is not played and that defeats the purpose of the sheet.

View 6 Replies View Related

Excel 2003 :: Macro To Open Folder Then User Selects File Then Macro Continues To Run

Nov 6, 2011

I use Excel 2003 at work. I'm looking for some code that will Open a folder and then lets the user to select a file then continues to run the macro.

The file name they select will look similar to this K2271011.504 or K3011111.201

View 3 Replies View Related

Move All Worksheets From Book B Behind All Sheets In Book A?

Jul 18, 2014

I made the following code to merge 2 workbooks together.

The code is to be executed when the user has Workbook A opened. (All sheets in workbook KPISWD are supposed to be moved after all worksheets in workbook KPICustomers).

I keep getting a debug error on the code that is supposed to do the actual move and loop until it is finished with all of the sheets in Workbook B.

Code:
Dim KPICustomers, KPISWD As String
KPICustomers = ActiveWorkbook.Name

Workbooks.Open Filename:= _
"W:FacturatieKPI per periode SWD.xls"

KPISWD = ActiveWorkbook.Name

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

View 3 Replies View Related

Copy Data From Book To Book Error

Jun 22, 2007

I have the below code, which now looks to see if a file is open or not, if it is, then copy and past 'Data' and if not open the book and copy 'Data'.

I think the code is sort of right, but im missing something, as i keep getting runtime error when i try and copy. Here is the
Sub PrintSaveKPIUpdate()

Dim sFilName As String
sFilName = "C: estCashSales_KPI.xls"
Set Main = ThisWorkbook

If IsOpen(sFilName) Then

' Book is Open.

Worksheets("Setup Data"). Range("Data").Activate

View 9 Replies View Related

Open And Close Files Using Excel Macro?

May 16, 2014

I have a folder which has a set of files (Files may be anything like excel,pdf,word..etc).My rrequirement is: When i run the macro the first file to last file should open and wait for 5 sec and then close..I mean first time the first file should open and wait for 5 sec and close..Next 2 nd files shoul open and close after 5 sec..next third files should open and close after 5 sec...Like wise till last file..Is this possible to achive through macro code..

View 7 Replies View Related

Macro To Close One Excel File And Open Another?

Jul 18, 2014

I have created several excel files as I cannot open them all at once since they are too large. So I have to open one excel file whilst closing another.

part1
part2
part3
part4
part5

I want a macro that opens the excel file part 1 and part 2. Then it should close part 1 and after closing part 1 it should open part 3. Once part 3 is open, part 2 should be closed and when part 2 is closed part 4 should open. When part 4 is open, then part 3 should be closed and part 5 should open.

View 1 Replies View Related

How Do I Get A Certain Macro To Run Anytime I Open Any Excel File

Sep 3, 2009

I want to put in an if-then statement in a macro that will check to what kind of report i open so it will automatically know what to do with it. Where do I put that macro? I tried it in auto_open in my personal.xlsb file but it stops before the file actually opens.

View 9 Replies View Related

Code Running When Already Open But Not When Newly Opened

Feb 26, 2014

Two workbook, A & B. Code in B copies some data over to a sheet in workbook A.

It does this not problems if A has remained open, but if it has just been opened, I get a "subscript out of range" error at the "With Workbooks" line.

The bit in red is what I have recently added to allow workbook A to be closed unless needed. Since adding this, the debug error has emerged, even though there was no problem when workbook A remained permanently open.

View 3 Replies View Related

Excel 2010 :: Using Macro To Open Network File

Jan 5, 2014

I am an extreme novice to using macros.

I used the 'record macro' feature to create the following: I created a rectangle box on sheet1 of NEW TEST.xlsm to link to the macros incidated below. Niether macro moves on after reaching the Workbooks.Open statement.

I am at a loss. Is there something in Excel that needs to be set? Is there something else that I need to do version of Excel is 14.0.6129.5000 (32 bit) MS Office Professional Plus 2010

What I am trying to accomplish is this: From 'NEW TEST.xlsm', open an excel file on the network, add a new sheet to this network file, calling it 'Pivot'. Then create a pivot table in this new sheet from the data in sheet data1 of this same network file. Then move control of macro / processing back to the NEW TEST file. Eventually I will do more, but for starters, I cannot even get the macro to add / name a new sheet in the network file.

[SIZE=3][COLOR=#000000][FONT=Arial]PS I have attached the NEW TEST.xlsm fikle as we as the data file. NOTE: the data file has been reduced to one day's worth of data, to to the upload file size.Also, my Excel Trustred locations has "Allow trusted locations on my network" checked, and the network location to the data file in trusted user locations.

VB:

Sub Open_Add_Sheet()
Dim filename, filelocation As String
Dim wb As Workbook
filename = "11 Nov, 2013 GDO AHS Agent Productivity Report.xls"
filelocation = "R:acharukAHS ReportsGDOGDO CSR ACTIVITY Report2013" & filename
Set wb = Workbooks.Open(filelocation) '
' Open_Add_Sheet Macro

[Code]....

View 9 Replies View Related

Run Excel Macro From Batch File. Workbook Open

Feb 24, 2009

I wanted to run a batch file which does something like,

Dir /b >Test.csv
Start Test.csv

And then runs an Excel macro once the workbook is open.

I looked into this and discovered that it’s not really that possible to run an excel macro through batch file but other options were to use ‘Workbook_Open’ etc.

I thought this might cause problems because Test.csv doesn’t contain a macro to auto open and because csv’s usually don’t like macros.

I do however have personal.xlsb which opens every time if that helps.

View 6 Replies View Related

Excel Macro - Open Windows Explorer Window Using VBA?

Jun 6, 2002

What's the code for opening a Windows Explorer window from within an Excel Macro?

View 7 Replies View Related

Excel 2007 :: Macro To Open File From A Folder

Oct 19, 2012

I just need a macro to open any excel file may be 2003, or 2007 from a folder.

I did tried Dir but not working. I want the macro in 2007.

View 4 Replies View Related







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