Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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
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
Up down arrow keys do not select cells if select locked cells unch roandrob Excel Discussion (Misc queries) 3 May 18th 09 12:48 AM
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
xy plot line style change when I select "fixed maximum" flobear Charts and Charting in Excel 1 November 17th 07 01:54 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
Changing from format style to list style B.W. Excel Worksheet Functions 1 November 22nd 06 07:53 PM


All times are GMT +1. The time now is 11:03 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"