Delete Macros In New Workbook OR Stop Them From Executing
Jul 7, 2014
I've got a macro embedded in a sheet (not in a module)..."Private Sub worksheet_activate()".
I have a macro that copies this specific sheet to a new workbook in order for other users to play with.
Problem is, when they select the new copied sheet in the new workbook, it tries to execute the "worksheet_activate" macro.
I've done searches on trying to delete macros but to no avail....
View 2 Replies
ADVERTISEMENT
Jul 23, 2005
What is the commands or script for deleting a macro automatically using
another workbook macro.
View 9 Replies
View Related
Jun 6, 2013
I noticed that my custom "Close without Saving" button stopped working. I checked the VBA editor and my Personal workbook was missing and all of my personal macros were gone. I restarted excel, same issue. Rebooted my machine and they re-appeared. Not sure how what happened, but at least the Personal workbook was not lost. I'm working off my company's network, so often I get the "Personal Workbook is locked for editing" message. I usually select the open as read-only file and go about my merry way. Perhaps I clicked something different on accident without paying attention.
Anyway, I digress, the custom macro button that I had in my ribbon still didn't work, so I removed it and tried again in both the ribbon and the quick access toolbar with no success. The Macro executes if I execute it manually or via the keyboard shortcut, but the ribbon/quick access toolbar buttons won't work. Frustrating, because I use this quite often. I've even tried writing a quick "dummy" macro to see if it was some sort of code error related to the macro, but got the same result. My "Close without saving" code is below (super basic code).
Sub Close_Without_Saving()'' Close_Without_Saving Macro' Closes active workbook without saving changes.'' Keyboard Shortcut: Ctrl+q' ActiveWorkbook.Close (False)End Sub
View 1 Replies
View Related
Jan 4, 2011
I want to delete all macros from my workbook (so it will work well in Mac 2008). I went to Alt-F11 and deleted all Macros there and check every sheet and found no references. I did all that and when I try to open it in Excel for Mac it says there are still Macros.
How can I ensure my workbook has no macros?
View 9 Replies
View Related
May 15, 2009
I want to delete names, formulas, macros of another workbook. For example, A.xls is my codes workbook. From this file, I want to delete the names, formulas, macros (but to keep the values & formatting in tact) of another workbook (there must be a prompt for which .xls file, the names etc. to be deleted). All files are in a same folder.
View 5 Replies
View Related
Sep 3, 2009
When running a macro is there a way you can execute code on another sheet within a workbook without being in the original sheet?
I seem to have a problem if I accidentally run a macro not on the original sheet whereby the code is executed and fills over data not in the desired sheet and the previous cells information is lost and the only way to fix the problem is to close the workbook and re-open a saved copy as you can't undo?
View 9 Replies
View Related
Dec 9, 2006
I've forgotten how to prevent the macros from showing in the macro dialogue box.
I'm sure it's got to be something with the VBA editor, but I can't figure it out.
I've got some files where the macro list is hidden and I'd like to do the same again, but for the life of me....I'm stumped. I'm sure it's something very simple.
I've protected the Worksheet & Workbook.
I've done some searching...."macro hide", "hide dialogue" etc. but can't seem to find what I'm looking for.
It's been a while since I had to amend code, as everythings been running very smoothly.
View 5 Replies
View Related
May 15, 2007
I am using a macro that automatically updates data obtained through a DDE link at 5 second intervals. My code is based off of the article "Automatically Run Macros at a Set Time or Date" found on the Ozgrid FAQs found here: http://www.ozgrid.com/Excel/run-macro-on-time.htm
However, I have this macro execute when I activate a Form Button, not when the workbook opens. So far, this macro works perfectly, and I have no problems. Although, I'd also like to include a Form button to STOP the macro from automatically running if the user chose to do so. How exactly would I go about making this STOP button?
View 4 Replies
View Related
Mar 28, 2014
I need to copy several macros from the Personal Macro workbook to a new workbook that I need to take to another computer. I need to be able to run the macros on that computer. I can only record macros and make minor changes in the VB editor. I do not know VB code.
View 5 Replies
View Related
Sep 12, 2006
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 5 Replies
View Related
Oct 12, 2007
I am trying to speed up this macro, ive already tried turning screenupdating and calculation off, but it still takes forever, and I dont understand why.
The code is basically searching for a given string in column E. There are about 9000 lines to my sheet, which shouldnt take more than a 30 seconds to a minute to complete.
Private Sub CommandButton1_Click()
Application.Calculation = xlCalculationManual
For MY_ROWS = Range("E12000").End(xlUp).Row To 1 Step -1
If Range("E" & MY_ROWS).Value UserForm1.ComboBox1.Value Then
Range("A" & MY_ROWS & ":E" & MY_ROWS).Delete (xlUp)
End If
Next MY_ROWS
Also anyone know how to add another condition to make the macro stop the delete process at lets say Range("a1:e8")?
View 9 Replies
View Related
Oct 11, 2009
I have a worksheet with 300 rows and I have a separate worksheet that contains graphs based on the data in the 300 rows.
The data is continually updated but stays at 300 rows. I add a new row at 301 and then I delete row 1.
I set the graphs up with a Chart Data Range of =GData!$B$1:$AB$300
As I add and delete rows the Chart Data Range reduces so after adding and deleting 3 rows the Chart Data Range is now =GData!$B$1:$AB$297
How can I get the Chart Data Range to stay at =GData!$B$1:$AB$300?
View 9 Replies
View Related
Jan 26, 2007
I have a file without password (on file there is sheet protection) & file in shared base with 31 sheets.
User can't do following things :
1. User can't Hide column and can't make a change in column width
2. User Can't delete any sheet from file.
if user do the above thing then undo the event or stop the above event.
This file is on shared mode and i don't want to use sheet protection
View 6 Replies
View Related
Nov 3, 2011
It's simple enough to delete all macros. I have a form that starts as a landing area for a bunch of data then it gets renamed. I want to delete both of my command buttons from the sheet and remove all of my macros. How am I going to pull this off, how can i save it to the sheet the first time?
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'cut command buttons
ActiveSheet.Shapes("CommandButton1").Select
Selection.Cut
ActiveSheet.Shapes("CommandButton2").Select
Selection.Cut
[Code] .........
View 1 Replies
View Related
Aug 9, 2007
How do I stop a user hiding a workbook using VBA? I have tried:
Private Sub workbook_deactivate
If windows(myfilename).visible = False Then
windows(myfilename).visible = True
End If
End If
This works but when I try to close all files sometime I have to press the top cross twice. This may be because one workbook references the rest.
View 2 Replies
View Related
Jan 30, 2009
I used the "Call" command instead of "Run." Everything finally worked perfect!!
Being new to VBA I do not know the reason behind the "Run" command being different and causing my problems. BUT "call" sure is the answer to my recent irritations.
After I got the darn things to finally work, I decided to do the responsible thing and use Option Explicit, which helped me clean up my code tremendously!!
View 3 Replies
View Related
Oct 15, 2004
Is there anyway in which I can open a spreadsheet and then delete any macros which exist in that file with VBA?
For Example
Workbooks.Open "\sysdevwebwCorpAcctSuiteReportsNetProfit.xls"
''Delete Any Existing Macros Code''
Activeworkbook.Save
Activeworkbook.Close
View 9 Replies
View Related
Jan 23, 2007
I managed to save workbook as values only by the help of this forum
Now is it possible to disable the commond buttons, when the workbook is saved as values only or can we delete the macro's.
View 3 Replies
View Related
Nov 24, 2009
I need to stop the calculations when the workbook opens. I have tried
View 2 Replies
View Related
Mar 18, 2009
I need to know how to make a workbook (and any/all copies made there from) cease to function (become irreversibly read-only) after a specific period of time following the first time it is loaded by a user (this would be preferable), or after a specified date (this could also work).
View 9 Replies
View Related
Aug 30, 2006
i am using the following code to close my userform and work book,this disables the exit button on the userform but i can still close the workbook by using the exit buttons on the sheet. can i disable the exit buttons on the sheet so the only way to close the workbook from the userform
Private Sub CmbClose_Click()
Dim ans As Variant
ans = MsgBox("This will close XL, save current file?", vbYesNoCancel)
If ans = vbYes Then 'save book and quit XL
ThisWorkbook.Save
Application.Quit
ElseIf ans = vbNo Then ' no save and quit XL
Application.Quit
ElseIf ans = vbCancel Then 'no save, no close , back to userform1
Exit Sub
End If
End Sub
View 7 Replies
View Related
Dec 1, 2006
I have a report whose calculation time I've reduced greatly by turning off automatic calculation and including in the worksheet code directions to only calculate the impacted range. BUT, it still takes a lot of time to calculate on close, when I turn automatic calculation back on. I'm afraid my users will think their machines have crashed. Does anyone know of a way so that on close, the workbook does not calculate, even though Calculation is turned back on to automatic?
Private Sub Workbook_Activate()
With Application
.Calculation = xlManual
.MaxChange = 0.001
.CalculateBeforeSave = False
End With
End Sub
Private Sub Workbook_Deactivate()
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
End Sub
View 2 Replies
View Related
Oct 15, 2007
I wanted to stop users from using cut and paste as well as drag and drop so I found something in Ozgrid to do that. (http://www.ozgrid.com/VBA/disable-cut-copy.htm)
Problem now is I am trying to run a macro that will copy and paste certain values, but because of the code I have added in the above link, whenever I click on a cell and copy it, when I click any other cell, the copy area gets cleared which of course disallows me from pasting it.
Private Sub Worksheet_Activate()
Dim oCtrl As Office.CommandBarControl
With Application
.CopyObjectsWithCells = True
.CellDragAndDrop = True
.CutCopyMode = True 'Clear clipboard
End With
'Enable all Cut menus
For Each oCtrl In Application. CommandBars.FindControls(ID:=21)
oCtrl.Enabled = True
Next oCtrl
'Enable all Copy menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = True
Next oCtrl.....................
View 2 Replies
View Related
Feb 15, 2008
I want to stop the formula auditing from working in one workbook without having to change settings in excel, is this possible?
View 3 Replies
View Related
Mar 26, 2009
I have several workbooks that contain the same worksheets. The worksheets within the several workbooks are structurally the same but have a different number of elements within the structure of the worksheets. I've written Macros that accommodate the difference in the number of elements in the worksheets and will perform the same appropriate tasks within all workbooks.
I use one of the workbooks for development and as I make changes in the Macros within this development workbook, I wish to update all the macros in the other workbooks.
I've been Exporting and Importing to accomplish the update. Is there a utility available that will accomplish this task? Something like "Copy all Modules from "Workbook1.xls"
View 10 Replies
View Related
Feb 6, 2007
I´m using this code to create a messagebox±
Private Sub Workbook_Open()
Dim c As Range
For Each c In Range("E2:E126")
If c > -15 And c < 0 Then MsgBox c.Offset(, -3), vbOKOnly + vbInformation, "LET OP! Einddatum contract nadert!"
Next
End Sub
The messageboxes may only appear when the workbook is opened. The problem is that they appear when I change something in the workbook.
View 4 Replies
View Related
May 21, 2014
So I'm trying my hand at creating VBA buttons and functions that do the following.
Button 1 :
to add a column with every click. The button will create one extra column. So by design there will be at least 1 column. Example if the button is clicked twice it will create 3 columns. I just need a buffer col. (contains no data)
Button 2 :
to delete empty columns leaving only one empty buffer column. That is this button will purge empty columns except the buffer column. OR if ALL the columns are filled, Button2 will create the buffer column.
Eg. I click Button 1 three times. It creates four columns. I only fill two columns. When Button 2 is clicked it will delete all the empty colums except the buffer column. OR I fill in all four columns, there is no buffer column, when I click Button2 it will insert the buffer col.
Button 3 :
to add a row with every click. The button will create one extra row. So by design there will be at least 1 row. Example if the button is clicked twice it will create 3 rows. I just need a buffer row. (contains no data)
Button 4 :
to delete empty row leaving only one empty buffer row. That is this button will purge empty row except the buffer row. OR if ALL the columns are filled, Button4 will create the buffer column.
Eg. I click Button 3 three times. It creates four rows. I only fill two rows. When Button 4 is clicked it will delete all the empty rows except the buffer rows. OR I fill in all four rows, there is no buffer rows, when I click Button4 it will insert the buffer row.
In the sample file there are six columns filled with data. The 7th col is empty(the buffer column). The column after that calculates the average of data in filled columns. There are eight rows with data and the ninth row is the empty buffer row.
The "add" buttons must be able copy the format/formula of the column/rows BEFORE the buffer colums/rows and insert it before the buffer column/row.
View 3 Replies
View Related
Mar 11, 2014
I have a sheet with macros that allows users to fill in data from columns F10 to O10 from row 10 to 54.
Column P will then make some computations based on the inputs from col F to O.
Row 55 will also make some computation based on inputs from row 10 to 54.
How to I modify the code below to allow users to either add/delete columns and rows such that it does not fowl up the computations?
The computation does not have to be at column P or at row 55, they can be dynamic and change depending on how many rows and columns the users delete/add.
A little background on what the code does. From Column F to O, the code UNLOCKS the columns only if user inputs date in Cell 3 of that particular column.
Example. Column F is locked from F10 to infinity at the start. Only when user inputs date into F3 does the cells F10:F54 is unlocked for user to input data.
This goes on until column O. I want users to be able to add more columns, or delete ones they don't need.
View 2 Replies
View Related
Jul 24, 2007
Currently I am using VBA Code below to Stop Update links prompts
Private Sub Workbook_Open()
Workbooks.Open "C:TempBook2.xls", UpdateLinks:=False
End Sub
Is there code I can use such This Workbook so that I can save this file as another name and it will work? Biz Auto Merged Post;Dear All, I have found VBA code that works.
Private Sub Workbook_Open()
Workbooks.Open ThisWorkbook.Name, UpdateLinks:=False
End Sub
View 3 Replies
View Related
Mar 14, 2007
I need to create a macros to open up 4 other workbooks and run each individual workbooks macro. The work books can be called book 1 to 4 and the macros is call run in each sheet.
When I have tried it manages to open the sheet but not run the macro.
View 8 Replies
View Related