Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Cells by Style
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Cells by Style
You know that
Dim r1, r2 As Range is the same as Dim r1 as Variant, r2 as Range don't you. -- Regards, Tom Ogilvy "Gary''s Student" wrote: 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Cells by Style
Thank you Tom.
-- Gary''s Student "Tom Ogilvy" wrote: You know that Dim r1, r2 As Range is the same as Dim r1 as Variant, r2 as Range don't you. -- Regards, Tom Ogilvy "Gary''s Student" wrote: 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Cells by Style
Thanks for the replies,
there seems to be no standard command like "Edit" = "GoTo" = "Special" = "Formulas". So I'm going to use a procedure like described above to detect the cells with a specific style. Regards Werner |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Cells by Style
columns(3).specialcells(xlformulas).Select
would certainly do that - so not sure what you mean. -- Regards, Tom Ogilvy "Werner Rohrmoser" wrote: Thanks for the replies, there seems to be no standard command like "Edit" = "GoTo" = "Special" = "Formulas". So I'm going to use a procedure like described above to detect the cells with a specific style. Regards Werner |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Up down arrow keys do not select cells if select locked cells unch | Excel Discussion (Misc queries) | |||
How to stop style for col A changing to style of co D date vs $ | Setting up and Configuration of Excel | |||
xy plot line style change when I select "fixed maximum" | Charts and Charting in Excel | |||
How do I change sheet notation from R1C1 style to A1 style in XL 2 | Setting up and Configuration of Excel | |||
Changing from format style to list style | Excel Worksheet Functions |