Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Conditional formatting overwritten with copy

Excel 2003. I have a worksheet using conditional formatting to put shading in
cells based on what's selected in another cell.
The cells with conditional formatting are unloacked to allow data entry. If
data is copy and pasted from another cell it overwrites the conditional
formatting. It only stays intact if I use the "Copy value" selection. The
problem is I won't be the only one using the file.
So the question is, how do I protect the conditional formatting or limt the
copy/paste function to values only?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Conditional formatting overwritten with copy

You could use this event code to retain the Formatting of the target cells.

Private Sub Worksheet_Change(ByVal Target As Range)
'retain formatting when a cell is copied over
Dim myValue
With Application
.EnableEvents = False
myValue = Target.Value
.Undo
Target = myValue
.EnableEvents = True
End With
End Sub

Right-click on the sheet tab and "View Code". Copy/paste the code into that
sheet module.

Alt + q to return to the Excel window.

Copy cells and paste into the CF cells.


Gord Dibben MS Excel MVP


On Thu, 22 May 2008 10:19:12 -0700, BillGriz
wrote:

Excel 2003. I have a worksheet using conditional formatting to put shading in
cells based on what's selected in another cell.
The cells with conditional formatting are unloacked to allow data entry. If
data is copy and pasted from another cell it overwrites the conditional
formatting. It only stays intact if I use the "Copy value" selection. The
problem is I won't be the only one using the file.
So the question is, how do I protect the conditional formatting or limt the
copy/paste function to values only?
Thanks


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Conditional formatting overwritten with copy

Good Stuff!!!
Thank you!
Bill

"Gord Dibben" wrote:

You could use this event code to retain the Formatting of the target cells.

Private Sub Worksheet_Change(ByVal Target As Range)
'retain formatting when a cell is copied over
Dim myValue
With Application
.EnableEvents = False
myValue = Target.Value
.Undo
Target = myValue
.EnableEvents = True
End With
End Sub

Right-click on the sheet tab and "View Code". Copy/paste the code into that
sheet module.

Alt + q to return to the Excel window.

Copy cells and paste into the CF cells.


Gord Dibben MS Excel MVP


On Thu, 22 May 2008 10:19:12 -0700, BillGriz
wrote:

Excel 2003. I have a worksheet using conditional formatting to put shading in
cells based on what's selected in another cell.
The cells with conditional formatting are unloacked to allow data entry. If
data is copy and pasted from another cell it overwrites the conditional
formatting. It only stays intact if I use the "Copy value" selection. The
problem is I won't be the only one using the file.
So the question is, how do I protect the conditional formatting or limt the
copy/paste function to values only?
Thanks



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Conditional formatting overwritten with copy

Thanks for the feedback.

Gord

On Thu, 22 May 2008 12:21:05 -0700, BillGriz
wrote:

Good Stuff!!!
Thank you!
Bill

"Gord Dibben" wrote:

You could use this event code to retain the Formatting of the target cells.

Private Sub Worksheet_Change(ByVal Target As Range)
'retain formatting when a cell is copied over
Dim myValue
With Application
.EnableEvents = False
myValue = Target.Value
.Undo
Target = myValue
.EnableEvents = True
End With
End Sub

Right-click on the sheet tab and "View Code". Copy/paste the code into that
sheet module.

Alt + q to return to the Excel window.

Copy cells and paste into the CF cells.


Gord Dibben MS Excel MVP


On Thu, 22 May 2008 10:19:12 -0700, BillGriz
wrote:

Excel 2003. I have a worksheet using conditional formatting to put shading in
cells based on what's selected in another cell.
The cells with conditional formatting are unloacked to allow data entry. If
data is copy and pasted from another cell it overwrites the conditional
formatting. It only stays intact if I use the "Copy value" selection. The
problem is I won't be the only one using the file.
So the question is, how do I protect the conditional formatting or limt the
copy/paste function to values only?
Thanks




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
copy conditional formatting Pammy Excel Discussion (Misc queries) 1 May 20th 08 05:27 PM
... Can I Copy Conditional Formatting... Dr. Darrell Excel Discussion (Misc queries) 1 December 1st 05 01:58 PM
Copy Conditional Formatting G Excel Discussion (Misc queries) 6 November 11th 05 08:24 PM
copy conditional formatting ajitbmunj New Users to Excel 2 September 29th 05 04:21 PM
How to copy conditional formatting Dan Excel Worksheet Functions 3 April 1st 05 12:33 AM


All times are GMT +1. The time now is 04:01 PM.

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"