Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Selecting non-adjacent rows

How do I programmatically select non-adjacent rows, in
order to change the format?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Selecting non-adjacent rows

Jon

Here's one way:

Sub test()
Dim FormatRange As Range

With Sheets("Sheet1")
Set FormatRange = Union(.Rows(3), .Rows(6), .Rows(9))

FormatRange.Interior.ColorIndex = 3
End With

End Sub


--
Best Regards
Leo Heuser
MVP Excel

Followup to newsgroup only please.

"Jon" skrev i en meddelelse
...
How do I programmatically select non-adjacent rows, in
order to change the format?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Selecting non-adjacent rows

I usually built up a range using Union and then select it:

Sub a()
Dim Counter As Integer
Dim Rg As Range
Set Rg = ActiveCell
For Counter = 1 To 10
Set Rg = Union(Rg, ActiveCell.Offset(Counter * 2))
Next
Rg.Select
End Sub


--
Jim Rech
Excel MVP


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Selecting non-adjacent rows

Jon, here is one way
Range("2:2,6:6,11:11,16:16,20:20").NumberFormat = "0.00_);[Red](0.00)"

--
Paul B
Always backup your data before trying something new
Using Excel 97 & 2000
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **

"Jon" wrote in message
...
How do I programmatically select non-adjacent rows, in
order to change the format?



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
Add cells on two adjacent rows but non-adjacent columns Eve Excel Worksheet Functions 14 October 20th 09 02:32 AM
Selecting non-adjacent data jdpf Excel Discussion (Misc queries) 2 April 9th 08 08:49 PM
Keyboard Navigation - selecting non-adjacent rows Katie Excel Discussion (Misc queries) 8 November 6th 07 06:20 PM
selecting adjacent cells wfcmark New Users to Excel 4 December 2nd 05 09:23 AM
selecting non adjacent cells fran Excel Worksheet Functions 4 April 25th 05 12:54 AM


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