Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Current region emulation | Excel Worksheet Functions | |||
looping through current region | Excel Programming | |||
Assigning name to current region | Excel Programming | |||
Naming Current Region | Excel Programming |