Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default MACRO PROBLEM - allowing only paste special

I was advised to use the following code for allowing the user to paste only
values instead of changing the entire cell format by Ctrl+V or Enter

The code went well, or rather great, but after a couple of date I have found
a problem that it doesn't allow me to "Find & Replace" showing error 1004

Upon Debug line 7, i.e. UNDO line, is highlighted

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
Application.CutCopyMode = False
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default MACRO PROBLEM - allowing only paste special

Hi,

I may be missing something here, but it seems to me that you could
simply use the PasteSpecial method with Paste set to values, i.e:

Range.PasteSpecial Paste:=xlPasteValues


FARAZ QURESHI wrote:
I was advised to use the following code for allowing the user to paste only
values instead of changing the entire cell format by Ctrl+V or Enter

The code went well, or rather great, but after a couple of date I have found
a problem that it doesn't allow me to "Find & Replace" showing error 1004

Upon Debug line 7, i.e. UNDO line, is highlighted

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
Application.CutCopyMode = False
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
Paste Special Problem ajkim001 Excel Discussion (Misc queries) 1 March 10th 06 11:50 PM
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
macro saving problem tweacle Excel Worksheet Functions 0 December 27th 05 12:29 PM
macro problem tweacle Excel Worksheet Functions 0 December 27th 05 12:27 PM
Macro to open workbook and copy and paste values in to orig workbo Dena X Excel Worksheet Functions 1 December 15th 05 11:13 PM


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