View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Select Cells by Style

Hi Werner:

Try this:

Sub gsnu()
Dim r1, r2 As Range
For Each r1 In Selection
If r1.Style = "Normal" Then
If r2 Is Nothing Then
Set r2 = r1
Else
Set r2 = Union(r2, r1)
End If
End If
Next
If Not r2 Is Nothing Then
r2.Select
End If
End Sub

Select an area and run the macro. Substitute your style for "Normal"
--
Gary''s Student


"Werner Rohrmoser" wrote:

Hello,

I've nothing found in the Online Help and in the USENET related to this
topic.
Is there a standard command to select cells with the same style or do I
have
to code something similar to John Walkenbach's "select by format" tool.
When I change a style I'd like to know which cells are affected, before
I apply it.

TIA
Werner