View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
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