Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to test for valid 'Paste:=xlValues' before attempt.
I have code that pastes values at the current selection.
This works fine when the 'copy' is within excel. However, occasionally the source may be from another application in which case the 'Paste:=xlValues' fails. Is there a way to test to see if 'Paste:=xlValues' is a valid option before using it in the following code? Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False Thank you. Dave |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to test for valid 'Paste:=xlValues' before attempt.
Bassman62,
I do not know a solution to check if pastevalues is a valid operation, however I have the following workaround on error resume next 'If error occurs while pasting special, go to next lin Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False if err.number < 0 then 'Paste special could not be performed, perform regular paste Activesheet.paste end if on error goto 0 'Reset error handling "Bassman62" wrote: I have code that pastes values at the current selection. This works fine when the 'copy' is within excel. However, occasionally the source may be from another application in which case the 'Paste:=xlValues' fails. Is there a way to test to see if 'Paste:=xlValues' is a valid option before using it in the following code? Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False Thank you. Dave |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to test for valid 'Paste:=xlValues' before attempt.
Dave,
If Application.CutCopyMode = xlCopy Then Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False End If HTH, Bernie MS Excel MVP "Bassman62" wrote in message ... I have code that pastes values at the current selection. This works fine when the 'copy' is within excel. However, occasionally the source may be from another application in which case the 'Paste:=xlValues' fails. Is there a way to test to see if 'Paste:=xlValues' is a valid option before using it in the following code? Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False Thank you. Dave |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sumproduct - Second Attempt | Excel Worksheet Functions | |||
Complie Error with xlValues | Excel Programming | |||
How to test if a workbook variable is valid | Excel Programming | |||
my first attempt at R1C1 in vba | Excel Programming | |||
How to test if a repertory is valid | Excel Programming |