Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default macro to highlight every second row within the current region

Hello everybody,

Do you know how to highlight every second row withing the
ActiveCell.CurrentRegion area with a macro (not conditional formatting)?

Thanks for your help!
Regards,
Mark


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default macro to highlight every second row within the current region

Hi
Sub tester()
Dim myrange As Range
Dim i As Long
On Error Resume Next 'incase you run off the end
Set myrange = ActiveCell.CurrentRegion
For i = 2 To myrange.Rows.Count Step 2
myrange.Rows(i).Interior.ColorIndex = 6
Next i
On Error GoTo 0
End Sub

regards
Paul

On May 11, 10:26 am, "markx" wrote:
Hello everybody,

Do you know how to highlight every second row withing the
ActiveCell.CurrentRegion area with a macro (not conditional formatting)?

Thanks for your help!
Regards,
Mark



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default macro to highlight every second row within the current region

One way:

Public Sub CurrentRegionShadeEveryOtherRow()
Dim i As Long
With ActiveCell.CurrentRegion
.Interior.ColorIndex = xlColorIndexNone
For i = 1 To .Rows.Count Step 2
.Cells(i, 1).Resize(1, .Columns.Count).Interior.ColorIndex = 6
Next i
End With
End Sub


In article ,
"markx" wrote:

Hello everybody,

Do you know how to highlight every second row withing the
ActiveCell.CurrentRegion area with a macro (not conditional formatting)?

Thanks for your help!
Regards,
Mark

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default macro to highlight every second row within the current region

You may want to glimpse at Format|autoformat, too.

If you like one, you could record a macro while you do it manually. Remember to
click that Options button to use the settings you like.

markx wrote:

Hello everybody,

Do you know how to highlight every second row withing the
ActiveCell.CurrentRegion area with a macro (not conditional formatting)?

Thanks for your help!
Regards,
Mark


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default macro to highlight every second row within the current region

Thanks for all three proposals guys, they work OK!
For the Format/Auto Format..., I was not at all aware of this option until
now, learned something new :-)

"Dave Peterson" wrote in message
...
You may want to glimpse at Format|autoformat, too.

If you like one, you could record a macro while you do it manually.
Remember to
click that Options button to use the settings you like.

markx wrote:

Hello everybody,

Do you know how to highlight every second row withing the
ActiveCell.CurrentRegion area with a macro (not conditional formatting)?

Thanks for your help!
Regards,
Mark


--

Dave Peterson



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
Current region emulation daverau Excel Worksheet Functions 5 October 16th 09 04:31 AM
looping through current region buffyslay Excel Programming 2 February 1st 06 05:58 PM
Assigning name to current region KDJ Excel Programming 2 August 21st 05 04:18 PM
Naming Current Region Gavin[_4_] Excel Programming 3 October 14th 03 03:38 PM


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