Run Macro When Worksheet Is Deleted

Feb 26, 2009

I have a macro i would like to run whenever a user deletes a worksheet...

I would like the user to be able click as normal to delete,(ie. right clicking the tab and selecting delete worksheet, or selecting delete worksheet from the menu) but would like to run my macro when they select delete.

I am using excel 07 if that helps, or i could use another version...

My macro will save a copy of the deleted worksheet as xlveryhidden as a backup..

View 9 Replies


Macro Runs Fast When Rows Added / Deleted Slow When No Rows Added / Deleted

Jun 27, 2013

We have created a macro that basically looks for rows that contain an "H" and hides the row if it does.

Users can add new rows throughtout the year to this spreadsheet. and based on certain criteria, an H or U will be placed in a hidden column which the macro looks at and hides any row it finds an H.

The user has to click on the button that has the macro assigned to it once they have finished working on the spreadsheet.

The problem we're finding is that for users who insert/delete rows, once they click the button it takes up to 15 seconds to run through macro (which is ok). However, users who haven't added or deleted any rows and who click the button, they have to wait upto 5 minutes (which isn't ok) for the macro ro run.

We can't figure out why the macro takes longer to run when no changes have been made?

View 8 Replies View Related

Detecting When A Worksheet Is Deleted

Mar 20, 2007

I am working on a workbook in which you can click a button on an index page to create a new sheet in the workbook with the name "meeting" and the number meeting that it is. The new sheet is then added to the index page. I am looking for a way to detect when a sheet is deleted so I can update my index page accordingly. I need to be able to know when a meeting is deleted so I can rename all meetings after that meeting and then update my index.

View 7 Replies View Related

Delete Cell When Worksheet Deleted

Jul 11, 2014

I want to delete a cell row in a table when I delete a corresponding worksheet with the same name as the cell.

For example, on the attached, if I delete the worksheet "Shawn" then I want row with "Shawn" deleted from the table on the "Example" tab. If I delete "Becky" worksheet then the row with "Becky" should be deleted from the table on the "Example" tab.

Delete cell when worksheet deleted.xlsx‎

View 4 Replies View Related

Macro Disable/enable Still Appears After Macro Deleted From Workbook

Oct 3, 2006

I have a question concerning Macros and the Disable/Enable prompt. My boss has a spreadsheet which has been used for years and he recently wanted to and did remove the macros from the spreadsheet (they were no longer necessary), but the disable/enable prompt still appears when the spreadsheet is opened. I replicated this in a test spreadsheet with a simple insert line macro and received the same results. Is there a way to remove the macros and the disable/enable prompt once they are removed? I know about setting the security to low to not see the prompt, but I would think that once the macros are deleted, the prompt should not appear any more.

View 2 Replies View Related

Macro: Deleted Record From Columns

Aug 21, 2009

Complete List of People in Column AA.
Partial lists of these same people in columns A, C, E, G, I, K.
Goal: Once I put that persons name in A, C, E, G, I, K, I would like it to be deleted from Column AA.

View 9 Replies View Related

Display Details Of Rows Deleted In Macro

Nov 25, 2006

I have a macro that deletes certain rows. I'd like the macro to tell me what it deleted specifically (if anything). Here's some of the macro:

For rownum = 1 To maxrownum

item = Cells(rownum, 1).Value
If item = "PUBS" Or item = "SWCDROM" Or item = "PC PACK" Then cells(rownum, 1).EntireRow.Delete

How do I get the macro to tell me if it deleted PUBS, SWCDROM, PC PACK, all three or nothing at all?

View 9 Replies View Related

Macro Resets Total In Text Box If A Number Deleted?

Jun 26, 2014

Attached file 140625 box adds.xlsm has three textboxes that are totalled in the fourth box.

The Code updates the total automatically as you ENTER numbers into cells, and overcomes "blanks", but I need it to update the total if you delete any of the three numbers.,

As shown below, I set the Code to "Exit Sub" if a cell becomes blank, but can't see how to invert it without going through the same "checking" process twice for the other cells.

As the Code structure is essentially the same for each box, I've just shown the first one here:

Private Sub TextBox1_Change()
If TextBox1.Value = "" Then Exit Sub [code]....

View 1 Replies View Related

Catch Deleted Row

May 19, 2008

I want to catch if the user has deleted a row. There is a need to know when a row is deleted and what the data was in that row. So, what I'm trying to do if a row is deleted is to undo the action and then change the font of all data in that row to have the strikethrough effect. This will enable others looking at the workbook to know that the information in the row existed but is no longer relevent.

So, the code is something like this:If row deleted Then
Target.Font.Strikethrough = True
End If

View 9 Replies View Related

Worksheet_change: Macro In One Worksheet To Run When Any Cell (in A Given Range)on A Different Worksheet (dataentry) Is Updated

Mar 27, 2007

I want a macro in one worksheet to run when any cell (in a given range)on a different worksheet (dataentry) is updated. I have spent along time trying to make it work with no avail. The code I use to start my macro is as follows.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count <> 1 Then Exit Sub

If Target(1, 1).Address = "dataentry!H5:IV72" Then
If Not Intersect(Target(1, 1), Range("dataentry!H5:IV72")) Is Nothing Then

On Error Resume Next
Application.EnableEvents = False

View 7 Replies View Related

A Moveable Text Box That Can't Be Deleted

Apr 8, 2009

I'm not sure what it's called, but in a workbook that was sent to me, when a cell is selected a text box appears with instructions in them. This is not a normal comment and I found that I cannot select it, right click it, or anything to delete them. They can be annoying as they cover up other data when the cell is selected.

View 2 Replies View Related

Keep Command Button After Row Is Deleted?

Jun 12, 2014

how to keep a command button in a certain location even if the a row or Column is Deleted or Inserted into the worksheet?

View 1 Replies View Related

Keep Row Height Of Deleted Row That Shifted?

Jul 16, 2014

I'm using the macro below to delete a row, which works but is there a way to keep the row heights for the row that is shifting up?

[Code] .....

View 9 Replies View Related

File Getting Too Big Because Of Arrows Not Being Deleted

Oct 3, 2013

I do a weekly report for my employer. We have our tabs conditionally formatted. We then insert the corresponding arrows to show a trend to the weekly variance. After the week is up I will delete a column and add a column to the end (making it a trended view) and move the arrows by selecting and dragging all of them into its respected week. I then go on to delete several arrows throughout the worksheet. For some reason my file continues to grow in size however I am only keeping a 12 week trend. The arrows are not deleting properly and are sitting in the background, where I cannot see them. I know this bc I did "find & Select" and chose selection pane. I was wondering how I can resolve this problem or maybe delete just certain columns of arrows (objects)? I had 61,000 arrows and shouldn't have more than a couple 1,000.

View 5 Replies View Related

Button Don't Get Deleted Completely

Dec 30, 2008

I have a problem regarding buttons.I have placed buttons on my excel sheet with a regular spacing between them.These buttons are placed dynamically on the sheet and I don't know what will be their names as user can add as many as they like.Now the problem is suppose there are two buttons in the range "A1:d8" and say now i delete the this range (using range("A1:d8").entirerow.delete) then buttons do not get completely deleted .A very thin line size button still remains on the sheet.

How to remove the buttons completely......

View 9 Replies View Related

Protecting File From Being Deleted

May 3, 2006

Is there a way to protect an excel file from accidently being deleted. I have a shared workbook, and I am concerned it might be deleted from the folder.

View 2 Replies View Related

Recover Deleted File

Jul 5, 2006

How can I recover a file I deleted? I looked in the Recycle Bin and do not see it.

View 2 Replies View Related

Track Deleted Row Or Column

Sep 13, 2006

How would I write this in vb. If a row or column deleted in sheet1 insert in sheet2 the date it was deleted, the coloumn or row cell name?

View 9 Replies View Related

Deleted Toolbar Won't Delete

Apr 20, 2007

I recently downloaded a macro which came with it's own button on it's own toolbar. (I can't remember the developer, but it's called Multihide and simplifies the hiding and unhiding of worksheets).

Now, I've copied the button onto my own toolbar, and tried deleting the toolbar (by the usual method - Cursor over toolbar, R-Click, Customise, highlight toolbar name, delete) which came with the macro, and although it at first looks as though it's gone, when I next restart Excel, it's there again. I find I can't delete the button from the toolbar either, nor delete the whole toolbar.

View 3 Replies View Related

Check If Formula Deleted

Jun 6, 2007

I have a spreadsheet that has a formula placed from cells B21 through to AT21. This formula is present in the sheet 95% of the time, but occassionally the user has to enter his/her own value in one of the cells.

How can I check or the user be reminded that he/she has deleted a formula and replaced it with a user defined value. ie a message box(only as a warning) to be displayed just before the workbook is printed. The user should be able to acknowledge the message displayed and carry on.

View 9 Replies View Related

Recover Deleted Range

Aug 31, 2007

While making a spreadsheet, I somehow deleted a much needed column. I didn't notice this until after I had made several changes and 'saved as' many times. Is there any way to retrieve this data? I'm not tech-savvy.

View 4 Replies View Related

Stop File Being Deleted

Oct 16, 2007

I have an Excel workbook that I do not want deleted. Is there any VBA code I can do to the document to stop this from happening? which Ic ould turn on/off?

View 4 Replies View Related

Macro Which Saves Data From Temp Worksheet To Customers Worksheet?

Mar 17, 2013

Dropbox - Final.xlsm

Here is the above link. Am looking at a button which saves whatever is the temp worksheet row in the customers worksheet. The temp worksheet basically takes the data from the Quotations worksheet and places it in a row.

View 9 Replies View Related

Distribution Of Percentage If 2 Items Deleted

Feb 16, 2014

AMOUNT 42400 is distributed among 6 people (C) in percentage if any of them or any 2 of them is deleted their contribution percentage need to be distributed among other.

I am attaching the example sheet... EXAMPLE.xlsx‎

View 1 Replies View Related

Restore Excel File After Deleted?

May 26, 2014

i accidentaly deleted excel file how can is recovery it

View 2 Replies View Related

Keep Reference To A Cell When Column Is Deleted

Nov 28, 2007

I have a spreadsheet in excel with scheduling information, each group of data (job) is made up over 2 columns and 6 rows and is in a block (this is so it is easy to view and manouvre)

I have a link in another worksheet that extracts information from the cell if a criteria in the group is met!

At the end of each day I need to delete the columns (B and C, which make up that day) in the schedule.

When I do this all the references in the other worksheet are messed up, even though the next day is moved to columns B and C.

I would like the link to the other worksheet to automaticaly recognise the new values in column B and C as the reference.

View 9 Replies View Related

Numbers Between Questionmarks In A String To Be Deleted

Dec 26, 2009

I have textstrings which have numbers between questionmarks included which I want to have deleted.

Here is an example : This ?112? is text 12 and this must ?9? be deleted.

I want to have it as : This is text 12 and this must be deleted.
Is this possible with the 'Substitute' function or is there another way to do this?

View 4 Replies View Related

To Save As All Worksheets But Modules Not Deleted

Mar 12, 2014

I want the macro in this way. All sheets of the workbook. The name of the worksheet to a new workbook save as. But the modules do not get deleted.

View 1 Replies View Related

Rightclick Cell Menu Deleted

Apr 24, 2009

I was customizing my rightclick cell menu, for cells in certain columns, to add some links to files and then I would delete them when right clicked in some other column.

By mistake I deleted EVERYTHING from my rightclick menu. If found where the problem was so it wouldn't happen again.

So now I am trying to put back those basic commands in the rightclick menu , but I cannot get those 'icons' that shows up on left of each command. how to get that?

View 2 Replies View Related

Deleted Data Leaves A Trace

Dec 8, 2009

I have a worksheet where I've deleted data in cells and rows. I am left with alternating rows of data and blank rows however a macro that I've been running to delete blank rows does not work on some of the rows.

To delete the data I used the Find and Replace feature and it seems that afterward the cells where this data was is now somehow marked as not completely empty. It appears empty but if I use the Control-Right Arrow combination from Column A, it skips over some cells but stops on a cell that used to contain data. If I press the Delete key it clears the cell completely and if I do that on all the cells the Ctrl-Right Arrow stops on until the end of the row, the macro works on that row...but not the next row of seemingly empty cells.

It's not spaces and there's no apostrophes and the cells are all formatted as General (Number Style) and Normal (Styles). I've even copied the format of a row of all deleted cells but that still does not completely clean out the "empty" cells. I've also run the Inspect Document command to remove what may be there but same results.

Is there something I can do to locate and remove this mysterious data?

View 7 Replies View Related

Copyrights 2005-15, All rights reserved