Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Finding cells using a style

Is there any way to find all the cells in a worksheet/workbook that use a
particular style? I can only think of looping over all cells but that will
be far too slow for the size of workbooks I have.

The problem I have is that I want to be able to change the number format on
all cells that have the Total style. The Total style though doesn't include
a number format currently, and instead will be either a number or percentage
depending on how the user has configured it. I need to update the decimal
places used in the cells, so was going to write a tool to look at all cells
with the Total style.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Finding cells using a style

In newer versions of excel (xl2002+, I think), you can show the Find dialog and
include formatting for the search criteria.

In fact, if you're doing it manually, you can look within the workbook.

But if you're doing it by code, you'll have to loop through the sheets.

You can record a macro when specify the formatting parms to get the syntax
correct.

If you're using xl2k or earlier, you'll be stuck looping through the worksheets
and through the usedranges.



Simon Reid wrote:

Is there any way to find all the cells in a worksheet/workbook that use a
particular style? I can only think of looping over all cells but that will
be far too slow for the size of workbooks I have.

The problem I have is that I want to be able to change the number format on
all cells that have the Total style. The Total style though doesn't include
a number format currently, and instead will be either a number or percentage
depending on how the user has configured it. I need to update the decimal
places used in the cells, so was going to write a tool to look at all cells
with the Total style.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Finding cells using a style

Great, I am using Excel 2007, and am actually coding it in C# using VSTO, I
assume you can use the Range.Find method?

"Dave Peterson" wrote:

In newer versions of excel (xl2002+, I think), you can show the Find dialog and
include formatting for the search criteria.

In fact, if you're doing it manually, you can look within the workbook.

But if you're doing it by code, you'll have to loop through the sheets.

You can record a macro when specify the formatting parms to get the syntax
correct.

If you're using xl2k or earlier, you'll be stuck looping through the worksheets
and through the usedranges.



Simon Reid wrote:

Is there any way to find all the cells in a worksheet/workbook that use a
particular style? I can only think of looping over all cells but that will
be far too slow for the size of workbooks I have.

The problem I have is that I want to be able to change the number format on
all cells that have the Total style. The Total style though doesn't include
a number format currently, and instead will be either a number or percentage
depending on how the user has configured it. I need to update the decimal
places used in the cells, so was going to write a tool to look at all cells
with the Total style.


--

Dave Peterson
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Finding cells using a style

I don't speak C# or VSTO. But I could do it in VBA.

Simon Reid wrote:

Great, I am using Excel 2007, and am actually coding it in C# using VSTO, I
assume you can use the Range.Find method?

"Dave Peterson" wrote:

In newer versions of excel (xl2002+, I think), you can show the Find dialog and
include formatting for the search criteria.

In fact, if you're doing it manually, you can look within the workbook.

But if you're doing it by code, you'll have to loop through the sheets.

You can record a macro when specify the formatting parms to get the syntax
correct.

If you're using xl2k or earlier, you'll be stuck looping through the worksheets
and through the usedranges.



Simon Reid wrote:

Is there any way to find all the cells in a worksheet/workbook that use a
particular style? I can only think of looping over all cells but that will
be far too slow for the size of workbooks I have.

The problem I have is that I want to be able to change the number format on
all cells that have the Total style. The Total style though doesn't include
a number format currently, and instead will be either a number or percentage
depending on how the user has configured it. I need to update the decimal
places used in the cells, so was going to write a tool to look at all cells
with the Total style.


--

Dave Peterson
.


--

Dave Peterson
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
How to stop style for col A changing to style of co D date vs $ Knowledge Seeker Setting up and Configuration of Excel 0 April 15th 08 03:26 PM
How do I change sheet notation from R1C1 style to A1 style in XL 2 Sherlock1506 Setting up and Configuration of Excel 1 December 5th 06 03:22 PM
How do I convert US style dates to European style? Neo Excel Discussion (Misc queries) 3 October 15th 06 02:24 PM
can a1 reference style and r1c1 style be used in same formula? rjagga Excel Worksheet Functions 1 September 17th 06 10:58 AM
Select Cells by Style Werner Rohrmoser Excel Programming 5 August 16th 06 08:13 PM


All times are GMT +1. The time now is 02:05 AM.

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"