Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default highlight row but allow copy and paste

Hello All-

I have a macro code that higlights the row where the active cell is on, but
the problem is that it won't all me to copy and paste unless i use the Office
Clip board, which i don't want to use. I would like to be able to right
click Copy-Paste. Below is the code that I am using. Can anyone help?


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----------------------------------------------------------------
Cells.FormatConditions.Delete
With Target
With .EntireRow

.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
.Interior.ColorIndex = 20
End With
End With

.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
.FormatConditions(1).Interior.ColorIndex = 36
End With
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default highlight row but allow copy and paste

One of the bad things about lots of macros is that they destroy the clipboard
when they run.

Maybe you could turn off events, then do the copy|paste, then turn events back
on.

Option Explicit
Sub TurnOffEvents()
application.enableevents = false
End Sub
Sub TurnOnEvents()
application.enableevents = True
End Sub


David T wrote:

Hello All-

I have a macro code that higlights the row where the active cell is on, but
the problem is that it won't all me to copy and paste unless i use the Office
Clip board, which i don't want to use. I would like to be able to right
click Copy-Paste. Below is the code that I am using. Can anyone help?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----------------------------------------------------------------
Cells.FormatConditions.Delete
With Target
With .EntireRow

.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
.Interior.ColorIndex = 20
End With
End With

.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
.FormatConditions(1).Interior.ColorIndex = 36
End With
End Sub


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default highlight row but allow copy and paste

Hey Dave-

I started to use your suggestion on another spreadsheet and it worked great.
However, when i try to share the workbook, it gives me an error message. Is
there anyway i can Enable Events and share the workbook at the same time?
Thanks.

"Dave Peterson" wrote:

One of the bad things about lots of macros is that they destroy the clipboard
when they run.

Maybe you could turn off events, then do the copy|paste, then turn events back
on.

Option Explicit
Sub TurnOffEvents()
application.enableevents = false
End Sub
Sub TurnOnEvents()
application.enableevents = True
End Sub


David T wrote:

Hello All-

I have a macro code that higlights the row where the active cell is on, but
the problem is that it won't all me to copy and paste unless i use the Office
Clip board, which i don't want to use. I would like to be able to right
click Copy-Paste. Below is the code that I am using. Can anyone help?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----------------------------------------------------------------
Cells.FormatConditions.Delete
With Target
With .EntireRow

.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
.Interior.ColorIndex = 20
End With
End With

.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
.FormatConditions(1).Interior.ColorIndex = 36
End With
End Sub


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default highlight row but allow copy and paste

I don't think it was the .enableevents that caused the heartache.

You can't change conditional formatting in a shared workbook. You're going to
have to look for a different solution.





David T wrote:

Hey Dave-

I started to use your suggestion on another spreadsheet and it worked great.
However, when i try to share the workbook, it gives me an error message. Is
there anyway i can Enable Events and share the workbook at the same time?
Thanks.

"Dave Peterson" wrote:

One of the bad things about lots of macros is that they destroy the clipboard
when they run.

Maybe you could turn off events, then do the copy|paste, then turn events back
on.

Option Explicit
Sub TurnOffEvents()
application.enableevents = false
End Sub
Sub TurnOnEvents()
application.enableevents = True
End Sub


David T wrote:

Hello All-

I have a macro code that higlights the row where the active cell is on, but
the problem is that it won't all me to copy and paste unless i use the Office
Clip board, which i don't want to use. I would like to be able to right
click Copy-Paste. Below is the code that I am using. Can anyone help?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----------------------------------------------------------------
Cells.FormatConditions.Delete
With Target
With .EntireRow

.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
.Interior.ColorIndex = 20
End With
End With

.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
.FormatConditions(1).Interior.ColorIndex = 36
End With
End Sub


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default highlight row but allow copy and paste

Hey...thanks for your response. I wanted to keep it as simple as possible.
The users of this worksheet are very simple users who prefer not to have turn
on and off the Events. I was hoping that with some modification of the code
below or even with a new coce, I would be able to copy/paste, or even use the
undo feature.

"David T" wrote:

Hello All-

I have a macro code that higlights the row where the active cell is on, but
the problem is that it won't all me to copy and paste unless i use the Office
Clip board, which i don't want to use. I would like to be able to right
click Copy-Paste. Below is the code that I am using. Can anyone help?


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----------------------------------------------------------------
Cells.FormatConditions.Delete
With Target
With .EntireRow

.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
.Interior.ColorIndex = 20
End With
End With

.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
.FormatConditions(1).Interior.ColorIndex = 36
End With
End Sub



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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Highlight / Copy down a long row? chris Excel Discussion (Misc queries) 2 October 24th 07 11:39 PM
paste and highlight the cells of range [email protected] Excel Discussion (Misc queries) 4 June 27th 07 11:13 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
I cannot paste from one workbook to another. Copy works, paste do. JimmyMc Excel Discussion (Misc queries) 1 June 10th 05 03:54 PM


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