Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select Range as far as.....

Thanks everbody,

Worked a treat, and Im (slowly) learning!!

Eddie


---
Message posted from http://www.ExcelForum.com/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default 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
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
How can change range to select active rows instead of :=Range("S10 ldiaz Excel Discussion (Misc queries) 7 August 29th 08 03:52 PM
I can't select a range in VBA bigjim Excel Discussion (Misc queries) 4 April 12th 08 12:43 AM
When entering data into a range of cells, select the entire range. Q Excel Discussion (Misc queries) 0 September 26th 07 04:36 AM
Select a range Eva Shanley[_2_] Excel Programming 4 October 20th 03 10:26 PM
Asking to Select a Range Irailson Excel Programming 2 September 3rd 03 04:40 PM


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