PC Review


Reply
Thread Tools Rate Thread

paste special in this vba code?

 
 
New Member
Join Date: May 2012
Posts: 2
 
      11th May 2012
This works great except for one thing. It duplicates conditional formating every time it copies. Is there a way to make it "paste special values" and leave the rest alone?

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rFrom As Range
If Target.Count = 1 Then
With Target.Worksheet
Set rFrom = .Range("A2:C280")
If Not Intersect(Target, rFrom) Is Nothing Then
Application.EnableEvents = False
'Include next line Just in Case something happens
' You don't want to leave EnableEvents off
On Error Resume Next
rFrom.Copy Worksheets("RS Scale").Range("A2:C280")
If Err.Number <> 0 Then
MsgBox "Error Occurred"
End If
Application.EnableEvents = True
End If
End With
End If
End Sub
 
Reply With Quote
 
 
 
 
New Member
Join Date: May 2012
Posts: 2
 
      11th May 2012
I got this to work. It's cleaner and faster. But if I highlight and clear multiple cells or press delete it does not erase it from the second sheet. I can live with that but if anyone has any tips to do make deleting multiple cells work, that would be great.

This version goes in the CS Scale sheet and a reverse sheet order goes in the RS Scale sheet. Works great.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rFrom As Range
If Target.Count = 1 Then
With Target.Worksheet
Worksheets("RS Scale").Range("A2:C500").Value = Worksheets("CS Scale").Range("A2:C500").Value
End With
End If
End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Special Copy, Paste Special macro usmc-r70 Microsoft Excel Programming 3 2nd Jul 2009 08:12 AM
Where can I find the old "Paste Special" (Edit/Paste Special)? =?Utf-8?B?SmFjcXVlcw==?= Microsoft Word Document Management 2 6th Jun 2006 04:24 PM
Where can I find the old "Paste Special" (Edit/Paste Special)? =?Utf-8?B?SmFjcXVlcw==?= Microsoft Word Document Management 0 6th Jun 2006 04:12 PM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Microsoft Excel Programming 3 7th Aug 2004 09:49 PM
PASTE SPECIAL - Paste Values vs Paste Unicode xterri Microsoft Excel Misc 1 30th Jun 2004 01:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:07 AM.