Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Range as far as.....
Hello All,
Id like to be able to highlight a row (whichever I have the curso currently on) but only as far as column AP. As a start Ive got: Sub VirtualRuler() ActiveCell.EntireRow.Select With Selection.Interior .ColorIndex = 36 .Pattern = xlSolid End With End Sub But this highlights all the way across the page. As a further point, it would be quite nice if the same button tha turns it on then removes it again, but I suspect the best way to d this would be to re-colour the whole page -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Range as far as.....
universal??,
Try this: Sub VirtualRuler() Range(Range("A" & ActiveCell.Row), _ Range("AP" & ActiveCell.Row)).Select With Selection.Interior ..ColorIndex = 36 ..Pattern = xlSolid End With End Sub John "universal " wrote in message ... Hello All, Id like to be able to highlight a row (whichever I have the cursor currently on) but only as far as column AP. As a start Ive got: Sub VirtualRuler() ActiveCell.EntireRow.Select With Selection.Interior ColorIndex = 36 Pattern = xlSolid End With End Sub But this highlights all the way across the page. As a further point, it would be quite nice if the same button that turns it on then removes it again, but I suspect the best way to do this would be to re-colour the whole page. --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Range as far as.....
Sub VirtualRuler()
Cells.Interior.ColorIndex = xlNone With Cells(ActiveCell.Row,1).Resize(1,42).Interior .ColorIndex = 36 .Pattern = xlSolid End With End Sub -- Regards, Tom Ogilvy "universal " wrote in message ... Hello All, Id like to be able to highlight a row (whichever I have the cursor currently on) but only as far as column AP. As a start Ive got: Sub VirtualRuler() ActiveCell.EntireRow.Select With Selection.Interior ColorIndex = 36 Pattern = xlSolid End With End Sub But this highlights all the way across the page. As a further point, it would be quite nice if the same button that turns it on then removes it again, but I suspect the best way to do this would be to re-colour the whole page. --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Range as far as.....
Thanks everbody,
Worked a treat, and Im (slowly) learning!! Eddie --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Range as far as.....
universal < wrote:
Hello All, Id like to be able to highlight a row (whichever I have the cursor currently on) but only as far as column AP. As a start Ive got: Sub VirtualRuler() ActiveCell.EntireRow.Select With Selection.Interior ColorIndex = 36 Pattern = xlSolid End With End Sub But this highlights all the way across the page. As a further point, it would be quite nice if the same button that turns it on then removes it again, but I suspect the best way to do this would be to re-colour the whole page. If I understand correctly, you want something like this: Sub Coloring() Range(Cells(ActiveCell.Row, 1), Cells(ActiveCell.Row, 42)).Select With Selection.Interior If .ColorIndex < -4142 Then .ColorIndex = -4142 Else _ .ColorIndex = 36 Pattern = xlSolid End With End Sub ' You don't even need to select the cells. Sub Coloring2() With Range(Cells(ActiveCell.Row, 1), _ Cells(ActiveCell.Row, 42)).Interior If .ColorIndex < -4142 Then .ColorIndex = -4142 Else _ .ColorIndex = 36 Pattern = xlSolid End With End Sub Regards, -- Beto Reply: Erase between the dot (inclusive) and the @. Responder: Borra la frase obvia y el punto previo. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can change range to select active rows instead of :=Range("S10 | Excel Discussion (Misc queries) | |||
I can't select a range in VBA | Excel Discussion (Misc queries) | |||
When entering data into a range of cells, select the entire range. | Excel Discussion (Misc queries) | |||
Select a range | Excel Programming | |||
Asking to Select a Range | Excel Programming |