Custom Cell Style - Shows as error and cannot be deleted

  • Thread starter Thread starter Paul C
  • Start date Start date
P

Paul C

I am using Excel 2007.

I have a large workbook (assembled from many sources) that contained many
unused custom cell styles. I was able to delete all of the custom styles
(many thanks to members of this discussion group) except one.

There is a style with the name 1. If I try to click on it in the ribbon I
get a system message box stating:

Style ' 1' not found.

If i use this code in VBA

Sub ststyles() i = ActiveWorkbook.Styles.Count
For A = 1 To i
ActiveCell = ActiveWorkbook.Styles(A).Name
ActiveCell.Offset(1, 0).Select
Next A

It shows up as the first style on the list.

I used this code to find the exact name.

Sub testdelete()
A = ActiveWorkbook.Styles(1).Name
ActiveWorkbook.Styles(A).Delete
End Sub

In the watch window A=" 1", but the program errors out on the delete line
with a message:

Run-time error '1004':
Delete method of Style class failed

I even tried Activeworkbook.Styles(1).Delete and got the same error.

Any ideas how to get rid of this style?
 
According to this site:
http://www.mrexcel.com/forum/showthread.php?t=40950

The error results because you have more than the maximu number of Styles.

Delete a few manually, then delete style 1.

Worked for me...



Paul wrote:

Custom Cell Style - Shows as error and cannot be deleted
09-Apr-09

I am using Excel 2007

I have a large workbook (assembled from many sources) that contained many
unused custom cell styles. I was able to delete all of the custom styles
(many thanks to members of this discussion group) except one

There is a style with the name 1. If I try to click on it in the ribbon I
get a system message box stating:

Style ' 1' not found

If i use this code in VB

Sub ststyles() i = ActiveWorkbook.Styles.Coun
For A = 1 To
ActiveCell = ActiveWorkbook.Styles(A).Nam
ActiveCell.Offset(1, 0).Selec
Next

It shows up as the first style on the list.

I used this code to find the exact name

Sub testdelete(
A = ActiveWorkbook.Styles(1).Nam
ActiveWorkbook.Styles(A).Delet
End Su

In the watch window A=" 1", but the program errors out on the delete line
with a message

Run-time error '1004'
Delete method of Style class faile

I even tried Activeworkbook.Styles(1).Delete and got the same error

Any ideas how to get rid of this style
--
If this helps, please remember to click yes.

Previous Posts In This Thread:

Custom Cell Style - Shows as error and cannot be deleted
I am using Excel 2007

I have a large workbook (assembled from many sources) that contained many
unused custom cell styles. I was able to delete all of the custom styles
(many thanks to members of this discussion group) except one

There is a style with the name 1. If I try to click on it in the ribbon I
get a system message box stating:

Style ' 1' not found

If i use this code in VB

Sub ststyles() i = ActiveWorkbook.Styles.Coun
For A = 1 To
ActiveCell = ActiveWorkbook.Styles(A).Nam
ActiveCell.Offset(1, 0).Selec
Next

It shows up as the first style on the list.

I used this code to find the exact name

Sub testdelete(
A = ActiveWorkbook.Styles(1).Nam
ActiveWorkbook.Styles(A).Delet
End Su

In the watch window A=" 1", but the program errors out on the delete line
with a message

Run-time error '1004'
Delete method of Style class faile

I even tried Activeworkbook.Styles(1).Delete and got the same error

Any ideas how to get rid of this style
--
If this helps, please remember to click yes.


Submitted via EggHeadCafe - Software Developer Portal of Choice
WPF Binding Beyond the Limitation of Name Scopes
http://www.eggheadcafe.com/tutorial...f-49faac8854c8/wpf-binding-beyond-the-li.aspx
 
I am using Excel 2007.

I have a large workbook (assembled from many sources) that contained many
unused custom cell styles. I was able to delete all of the custom styles
(many thanks to members of this discussion group) except one.

There is a style with the name 1. If I try to click on it in the ribbon I
get a system message box stating:

Style ' 1' not found.

If i use this code in VBA

Sub ststyles() i = ActiveWorkbook.Styles.Count
For A = 1 To i
ActiveCell = ActiveWorkbook.Styles(A).Name
ActiveCell.Offset(1, 0).Select
Next A

It shows up as the first style on the list.

I used this code to find the exact name.

Sub testdelete()
A = ActiveWorkbook.Styles(1).Name
ActiveWorkbook.Styles(A).Delete
End Sub

In the watch window A=" 1", but the program errors out on the delete line
with a message:

Run-time error '1004':
Delete method of Style class failed

I even tried Activeworkbook.Styles(1).Delete and got the same error.

Any ideas how to get rid of this style?

Paul - were you ever able to fix this?
 
Back
Top