Run-time error for objects deletion

Hi, 

I have made a list of option button. When I select a particular option, the 
excel should identify and delete the previous object names starting with 
"onstrfr". However, when it identifies the correct obj name "onstrfr", the 
obj.Delete gives "Run-time error '1004': Application-defined or 
object-defined error". 

I'll be grateful if someone can help me to solve this problem. 

Loy
=== FROM Sheet1=======
Private Sub on3wdgtrfroption_Click()
    Call Sheet2.Deleteonstrfr
    Call Sheet2.OnshoreTrfr(myValue, 2)
End Sub

===From Sheet2========

Sub Deleteonstrfr()
Dim Obj As Object
For Each Obj In ThisWorkbook.Sheets("SLD").Shapes
    If Left(Obj.Name, 7) = "onstrfr" Then
        MsgBox Obj.Name
        Obj.Delete
    End If
Next Obj
End Sub


0
Utf
1/7/2010 10:05:01 AM
excel.programming 6508 articles. 2 followers. Follow

2 Replies
1224 Views

Similar Articles

[PageSpeed] 53

Personally I restrict the subs in a worksheet module to events related to the 
worksheet. All other subs I put in a standard module.

You might get some other views on this but I have seen lots of strange 
things occur when you put subs that are not really related to the specific 
worksheet in the worksheet module.

Put the called routine (Sub Deleteonstrfr) in a standard module and try it.

-- 
Regards,

OssieMac
 
0
Utf
1/7/2010 10:53:02 AM
Thanks very much for your advice. The problem seems to go away after placing 
the Subroutine in the standard Module. 

Best wishes, Loy
"OssieMac" wrote:

> Personally I restrict the subs in a worksheet module to events related to the 
> worksheet. All other subs I put in a standard module.
> 
> You might get some other views on this but I have seen lots of strange 
> things occur when you put subs that are not really related to the specific 
> worksheet in the worksheet module.
> 
> Put the called routine (Sub Deleteonstrfr) in a standard module and try it.
> 
> -- 
> Regards,
> 
> OssieMac
>  
0
Utf
1/7/2010 11:44:01 AM
Reply:

Similar Artilces:

Matching data in different sheets but slight difference in time va
Hi Please help. I have two sheets as follows: Sheet 1: Date / Time / Number Dailled / Duration /Cost 22/1/10 10:00 01234123456 00:01:57 0.789 Sheet 2: Date / Time / Number Dailled / Duration /Extension 22/1/10 10:02 01234123456 00:01:56 1501 I am trying to put the cost of the phone call against the relevant extension on sheet 2 that has dialled the number dialled. Obviously I can match the number dialled in both cases, and the...

Windows mail error message 12-18-09
What that means?: The message could not be sent. The authentication setting might not be correct for your outgoing e-mail [SMTP] server. For help solving this problem, go to Help, search for "Troubleshoot Windows Mail", and read the "I'm having problems sending e-mail" section. If you need help determining the proper server settings, please contact your e-mail service provider. The rejected e-mail address was 'phoenixgym@aol.com'. Subject 'World Champion Kayla Williams is competing in the Excalibur Cup 2010 (Virginia Beach)', Account: ...

Windows Media Player cannot play file because a network error occu
I am using Media Player 11 in Windows Vista and I cannot seem to play videos imbedded on websites. If someone sends me a WMV file in email, I can play it just fine. Just not ones on websites. I do not get an error code. Only a pop-up box that says what I have in the subject line - plus "The server might not be available. Verify that you are connected to the network and that your proxy settings are correct." A friend of mine also has MP 11 and Vista and it works just fine. On Fri, 13 Nov 2009 09:29:02 -0800, his1987 <his1987@discussions.microsoft.com&g...

Entourage Error 107
Recently, I have not been able to sent or receive corporate email from Entourage. Error: Am unknown error has occurred in Entourage Explanation: Mail could not be sent Account name: Sprint Exchange Account Error 107 Mac's are not supported by IT here. I have verified my settings in Entourage with other unsupported Corp Mac users and everything seems to be set correctly. I am running Mac Office/Entourage 2008 and have applied all available updates. Any help would be greatly appreciated. Thanks, -Greg Greg wrote: > Recently, I have not been able to sent or rec...

Display images on a running form
I have table with information fields which belongs to images stored on the network. So in my table I also have a field with the path to each image. Now we display every record in single modus, but if you look for a specified image, it is hard to search. Now I want to display the form showing all records at once (running form mode...?), but the problem is that is shows the same image (the first one) at all records. I do not want to have the images in the table (database), but want to use the path because there are a lot of images. Is there a way that I can use the running form mode and displa...

Re: 'Uknown Error 0x800CCC97'
I just heard back from the folks with whom I filed this bug. They say the bug is fixed in cppop 5.4 - request that your ISP upgrade to that. -- Jeff Stephenson Outlook Development This posting is provided "AS IS" with no warranties, and confers no rights "Jeff Stephenson [MSFT]" <stephenson@online.microsoft.com> wrote in message news:... > See the attached reply to another similar question. Your ISP's POP3 server > has a bug, and they should get a fixed version of the server. > > -- > Jeff Stephenson > Outlook Development > This posting...

Time series #2
I have several tabs for different dates with data in it. Colomn contains the time in format 13:30:30. For my project, I require to know the number of data points in variou time series, pls see below. 7:30:00 8:30:00 8:30:00 9:30:00 9:30:00 10:30:00 10:30:00 11:30:00 11:30:00 12:30:00 12:30:00 13:30:00 13:30:00 14:30:00 14:30:00 15:30:00 15:30:00 16:00:00 I tried countif and if function but could not come up with the results PLS HELP. If I have to do it manually then I am dead..... -- mohitmahaja ----------------------------------------------------------------------- mohitmahajan's ...

Windows 2003 Server as Authoritative Time Server
Hello, How do I make my W2K3 PDC as an authoritative Time server for my domain? I have a GPS based time sync solution on my PDC. I have tried all solutions on the net, but none seems to work. The clients are not able to get any valid servers. Any help will be appreciable. Thanks Jagsrao ...

Econnect error when same item on PO more than once when receiving.
DOC 30 ERROR: Microsoft.Dynamics.GP.eConnect: Number = 9344 Stored Procedure taPopRcptLineInsert : Description = PO Line number is required - item exists on more than one line. Does Econnect not support this scenario while the GP screens do? Thanks. Rich: I had the same type of error but awhile back but I was passing my document wrong when I was trying to update it. I had the same item number on seperate lines and of course I never passed the parameter @I_vPOLNENUM. Well of course eConnect didn't know which line to update thus I kept getting that 9344 error. After some t...

Error Message When Opening Excel #3
Everytime i open Excel or an Excel document, i get the following error message: "SUMIF.XLA is already open. Reopening will cause any change you made to be discarded. Do you want to reopen SUMIF.XLA?" Whether i answer YES or NO, the application will open normally. It is just very annouying.. HELP -- W Walid You could try looking under Tools>Add ins... and then uncheck anything, then check back those that were checked one at a time, close and re-open excel, when the error comes back, that's the faulty add-in, either go to the vendor or unload the add-in if you don&#...

Date/time range based calculations
I have a column of values associated with unique dates/times. I need to be able to perform different calculations on the column of values based on whether or not their associated unique dates/times are between a set of date/time ranges (upper and lower limits). What function should I be using to calculate column C based on the date/time ranges? Example: Column A Column B Column C Row 1 Start Time 03/01/2005 00:29:59 Row 2 End Time 03/01/2005 00:59:59 Row 3 Row 4 DATE/TIME VALUE ...

can't delete a corrupt record in a access 2007 table?
Access 2007 program but Access 2000 File format, Can't delete a corrupt record in a table, weird symbols, search error. ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- I'm assuming that you tried a compact and repair. Are the weird symbols in a memo field? If so, here's what to try. 1. Make a complete backup of the database mdb file(s) and put away for safe keeping. 2. Create a query ...

Access to Microsoft forums and error 13
I wanted to get a wider audience for the error 13 problem that may have been fixed with the latest download. I signed up for the Microsoft's green button, received a confirmation but can't log on. I probably have to wait for someone to come in on Monday. Meanwhile, could someone use the green button media center forum to confirm that the problem was introduced with the previous to last fix and the latest fix solved the problem. I can't verify the fix because I switched to cable and the problem is unique to dialup (switched lines). There's no information with ...

How to copy "Ignore Error" all through?
Hello I have a formula wherein the result is ok, but gets flagged "missing adjacent cells". I select the "Ignore this error" but how to copy this across all cells? Or do I have to do it on every cell? Thanks Select that whole range--make the active cell one of the cells with that error. Then click on the flag and choose "Ignore Error". dindigul wrote: > > Hello > I have a formula wherein the result is ok, but gets flagged "missing > adjacent cells". I select the "Ignore this error" but how to copy this > across all cells?...

Error in database....
A user posted a batch in payables management. After posting, there was an error encountered. It displays that the table updating was interrupted, use batch recovery to continue the posting. But when I used the batch recovery, it was not successful to continue the update process. When I click the "More Details" button it displays, A save operation on table 'PM_Transaction_WORK' caused a sharing error. How can I resolve this issue? Thanks, John John, it is a db sharing violation. Have all users logout DELETE tempdb..DEX_LOCK DELETE tempd..DEX_SESSION DELETE dynami...

Error Connecting
Using Outlook 2003 w/ Windows XP Pro, error occurs when attempting to download an email (spam) that has no subject line or sender address. I can download Inbox headers and delete the offending email, then continue email download. Have seen other threads w/ similar problem, but no solution found yet. Obviously I can work around it, but I get this type of spam 2 to 3 times a week (sometimes 2 or 3 a day). If I download 20 emails before it hits this snag, I either get to download them again, or go through the headers and delete the ones I've already received. Incapacitating? - No. Anno...

delete a selection
how do i delete part of a chart to leave no unwanted space.. Hi, We are going to need more information. What chart type? Where is the space you want to remove? Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "flirtacious" <flirtacious@discussions.microsoft.com> wrote in message news:7111EAE4-0C9A-480E-BDDF-73727FB892A1@microsoft.com... > how do i delete part of a chart to leave no unwanted space.. On Nov 22, 3:10 pm, flirtacious <flirtaci...@discussions.microsoft.com> wrote: > how do i delete part of a chart to leave no unwanted...

Event Error Question
Can anyone tell me what the foioloing event eree is and if there is a way to prevent it? Event filter with query "SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA "Win32_Processor" AND TargetInstance.LoadPercentage > 99" could not be reactivated in namespace "//./root/CIMV2" because of error 0x80041003. Events cannot be delivered through this filter until the problem is corrected. I google the event adn got several different opinions, one being caused by root worms?? James ...

ntuser.dat error message
When I bring up Outlook Express, I'm receiving the following error message: Cannot delete ntuser.dat: It is being used by another person or program. Close any programs that might be using the file and try again. This just started happening in the past few days. Outlook is the 1st thing (and only program that I know of) that is running. How can I make this stop. I'm lost. Regards Gerry Hi Gerry, I understand you are receiving the following error message when you open Outlook Express. "Cannot delete ntuser.dat: It is being used by another person or program, close any programs...

Could not delete from specified tables
I created the following query but I get the "Could Not Delete From Specified Tables" error. Although I have access to the table and can delete from that table manually. my query is as follows: DELETE DISTINCTROW tblSatAdv.* FROM tblSatAdv INNER JOIN ( SELECT Max(tblSatAdv.SnapshotInvDte) AS MaxOfSnapshotInvDte FROM tblSatAdv ) AS MAXDTE ON tblSatAdv.SnapshotInvDte = MAXDTE.MaxOfSnapshotInvDte; It is not possible to delete using a aggregate sub Query as a joined "table" Pieter "ISUTri" <GraberJ@gmail.com> wrote in message news:ce6eaad7-6db5-4f03-...

How do I get one cell to record the time another cell was changed.
I know there's a simple solution to this, but I'm not seeing it. How can I set up a cell to update the time (or date) whenever another cell has data entered into it; e.g. cell A1 has new info entered into it, and cell A2 automatically updates the time of that update. Thanks in advance. One way http://www.mcgimpsey.com/excel/timestamp.html Regards, Peo Sjoblom "Reigning in Seattle" wrote: > I know there's a simple solution to this, but I'm not seeing it. How can I > set up a cell to update the time (or date) whenever another cell has data > ente...

Outlook errors #2
When I start Outlook it immediately comes up with an error: msouplug.dll Does anyone have any advice on how to repair this fault or is there a way to get access to the contacts within Outlook if I cannot get it to open? Thank you Do you have any Symantec programs installed for Outlook? I believe that's where this file comes from. If you start Outlook in safe mode, you should be able to get in and remove that add-in. Close Outlook Select Start | Run Enter Outlook.exe /Safe Select OK Select Tools | Options | Other | Advanced Options | Add-In Manager Uncheck any Symantec add-in...

XML error "Some Data Was Imported As Text"
Daily, I recieve a 3rd party XML file that I parse in Excel (using an excel macro) and then import into an Access database. Infrequently, the data will import into Excel, then parse and then the routine stops with the error message above. I look through the raw XML file and everything appears to be within the brackets, etc. Can someone give me some clarification to the meaning of the error message? Thanks in advance and Mery Christmas and Happy Holidays! The error message might be generated within your macro - as it is parsing the data it might detect that some field which should be ...

running a macro on several sheets
HI, I have a spreadsheet and I am trying to run a macro on all sheets. Here is my code for the first sheet called U.S. Sub whatColor() For counter = 5 To 15 cell = Worksheets("U.S.")Cells(counter, 38) If cell = 0 Then Worksheets("U.S.").Cells(counter, 35).Interior.ColorIndex = 0 'Better than last year, better than plan' ElseIf cell = 1 Then Worksheets("U.S.").Cells(counter, 35).Interior.ColorIndex = 4 'green' 'Better than last year, below plan' ElseIf cell = 2 The...

How to delete user mailbox
Since I no longer have 5.5 installed (up'd to 2K) I had a friend ask how to delete a user mailbox and cannot for the life of me remember the interface for 5.5 and how to do that. Can someone give me the step by step to delete a mailbox cleanly? Thx select the mailbox in the Exchange Admin program and hit the delete key... "aaa" <anonymous@discussions.microsoft.com> wrote in message news:1380c01c44417$2d87fd40$a301280a@phx.gbl... > Since I no longer have 5.5 installed (up'd to 2K) I had a > friend ask how to delete a user mailbox and cannot for > the lif...