Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Colour active row but allow copy / paste

Hi All,

I have trawled the newsgroups for code to highlight the active row.
Below is the code that l am currently using which works fine until you
want to carry out copy / paste on the active worksheet.

Does anybody have the code that colours the active row AND allows copy
/ paste on the active worksheet?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Static OldRange As Range
Target.EntireRow.Interior.ColorIndex = 36

If Not OldRange Is Nothing Then
OldRange.EntireRow.Interior.ColorIndex = xlNone
End If

Set OldRange = Target

End Sub

All suggestions gratefully received.

Regards

Michael Beckinsale

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 222
Default Colour active row but allow copy / paste

Have a look at the following:

http://www.cpearson.com/excel/RowLiner.htm

Not exactly what you want but very useful.

" wrote:

Hi All,

I have trawled the newsgroups for code to highlight the active row.
Below is the code that l am currently using which works fine until you
want to carry out copy / paste on the active worksheet.

Does anybody have the code that colours the active row AND allows copy
/ paste on the active worksheet?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Static OldRange As Range
Target.EntireRow.Interior.ColorIndex = 36

If Not OldRange Is Nothing Then
OldRange.EntireRow.Interior.ColorIndex = xlNone
End If

Set OldRange = Target

End Sub

All suggestions gratefully received.

Regards

Michael Beckinsale


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Colour active row but allow copy / paste

Hi Michael,

Unfortunately changing cells in the event cancels cut/copy. Perhaps disable
changes if in cut or copy mode -

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static OldRange As Range

If Application.CutCopyMode = 0 Then

If Not OldRange Is Nothing Then
OldRange.EntireRow.Interior.ColorIndex = xlNone
End If

Set OldRange = Target(1).EntireRow
OldRange.Interior.ColorIndex = 36
Else
If OldRange Is Nothing Then
Set OldRange = Target(1).EntireRow
Else
Set OldRange = Union(OldRange, Target(1).EntireRow)
End If
End If

End Sub

Apart from disabling I've made some other changes to your routine which you
may or may not prefer - previously selecting another cell in same row left
the row un-coloured (another way is first remove format from all rows in the
used range and not bother with "OldRange").

This is far from satisfactory but might be enough for your needs. I wouldn't
use this myself! (though I do use something very vaguely along the lines of
Chip Pearson's RowLiner as referred to you by "bigwheel").

Regards,
Peter T

wrote in message
oups.com...
Hi All,

I have trawled the newsgroups for code to highlight the active row.
Below is the code that l am currently using which works fine until you
want to carry out copy / paste on the active worksheet.

Does anybody have the code that colours the active row AND allows copy
/ paste on the active worksheet?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Static OldRange As Range
Target.EntireRow.Interior.ColorIndex = 36

If Not OldRange Is Nothing Then
OldRange.EntireRow.Interior.ColorIndex = xlNone
End If

Set OldRange = Target

End Sub

All suggestions gratefully received.

Regards

Michael Beckinsale



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Colour active row but allow copy / paste

Peter,

Many thanks for the reply. I was thinking of "messing about" with the
code along the lines that you have provided.

I will code a try and let you know how l get on

Regards

Michael

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
Active cell default colour Boyd Excel Discussion (Misc queries) 1 October 23rd 08 12:50 AM
Active Cell Copy And Paste Sheet to Sheet A.R.J Allan Jefferys New Users to Excel 4 May 4th 06 02:04 AM
Copy Paste from Active cell briank Excel Programming 3 June 6th 05 11:56 PM
HOW TO COPY 480 ACTIVE E-MAIL ADDRESSES CLM "G" ON AN ACTIVE EXCE. ragman10 Excel Discussion (Misc queries) 1 December 13th 04 11:52 PM
copy/paste based on colour criteria gavinM Excel Programming 0 May 11th 04 02:41 AM


All times are GMT +1. The time now is 03:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"