Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 269
Default 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 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?
--
If this helps, please remember to click yes.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Deleting Style 1 not found

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 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?
--
If this helps, please remember to click yes.

Previous Posts In This Thread:

On Thursday, April 09, 2009 1:47 PM
Paul wrote:

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 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?
--
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/tutorials...nd-the-li.aspx
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Custom Cell Style - Shows as error and cannot be deleted

On Thursday, April 9, 2009 11:47:01 AM UTC-6, Paul C wrote:
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?
--
If this helps, please remember to click yes.


Paul - were you ever able to fix this?
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
'Reset to Match Style' removes all formatting from custom chart Simon Reid Charts and Charting in Excel 0 November 13th 08 06:49 PM
07 Custom style does display banded column styles in preview rakilgore Excel Discussion (Misc queries) 0 July 16th 08 06:50 PM
Style 'Percent' not found error message. DanG Excel Discussion (Misc queries) 2 April 10th 07 03:36 AM
cell shows 20. Formula shows 20. why not 540/27 griswold Excel Worksheet Functions 2 August 12th 05 05:56 PM
Custom format that shows blank cell if another cell is empty Zdenek Moravec Excel Discussion (Misc queries) 1 March 25th 05 12:45 PM


All times are GMT +1. The time now is 03:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"