Excel unresponsive when running a macro

Adar123

Board Regular
Joined
Apr 1, 2018
Messages
83
Office Version
  1. 2016
  2. 2010
Platform
  1. Windows
Hi all,

When I run a macro Excel becomes unresponsive - hope you could help. The code is made to remove all styles in the document. I suspect that either I have an error in a code, forgot one of the 101 VBA steps or perhaps it is just too much to process for the program and some modification are required.


  • the worksheet is saved in .xlsm format;
  • automatic calculations are turned off;
  • the file is saved locally on my PC, not in an archive.

I am using a Microsoft office 2013, also tried in MS Office 2010. Tried finding solution ideas in other threads but the search was unsuccessful.

Many thanks for your help.

Code:
[TABLE="width: 620"]
<tbody>[TR]
[TD="class: code"]Sub StyleKill()
     Dim styT As Style
     Dim intRet As Integer
     On Error Resume Next
     For Each styT In ActiveWorkbook.Styles
         If Not styT.BuiltIn Then
             If styT.Name <> "1" Then styT.Delete
         End If
     Next styT
 End Sub[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
try this
Code:
Sub StyleKill()
     Dim styT As Style
     Dim intRet As Integer
     On Error Resume Next
     For Each styT In ActiveWorkbook.Styles
         If Not styT.BuiltIn Then
             If styT.Name <> "1" Then styT.Delete
         End If
       [COLOR=#ff0000]  Application.StatusBar = styT[/COLOR]
     Next styT
[COLOR=#ff0000]     Application.StatusBar = ""[/COLOR]
 End Sub
watch the bottom left of the screen and see if the count changes
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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