Can I delete a sheet stepping through a macro ie 'in break mode'?

berlinhammer

Board Regular
Joined
Jan 30, 2009
Messages
187
Hello

I am trying to write a program and step through but am encountering an irritating problem. I need to delete a sheet but the warning keep forcing me out of break mode. Disabling the Application.DisplayAlerts does not seem to be working.

I won't get the error when I run the code but as I am currently in construction and do not want to run the full code yet, I just want to step through one step at at time and this sheet deleting is preventing me doing so, which is proving a bit of a pain.

Can I do this the way I would like?

Thanks

Jon

Code:
Sub example()

    Application.DisplayAlerts = False
    ThisWorkbook.Sheets(3).Delete
    Application.DisplayAlerts = True

End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
That should work OK when you step through the code using F8, is there workbook protection on by any chance?
 
Upvote 0
I'm not sure Dave I certainly didn't intend to protect it.

Have you got a code snippet I can check with by any chance?

?wsN.ProtectionMode is giving me false in the immediate window.

My move worksheet method is failing on this sheet also, so you may be onto something there but I'm not sure how to check for my protection settings on the sheet?

Thanks for replying

Jon
 
Upvote 0
I haven't got a decisive code but I've been fiddling about in any thing to do with Properties I can and I do not think it is protected.
 
Upvote 0
Check the workbook structure, Tools>>Protection or Review Tab if using Excel 2007 + and see if Unprotect Workbook is an option.
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,741
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top