ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Works every second time (https://www.excelbanter.com/excel-programming/351008-works-every-second-time.html)

hih

Works every second time
 

Hello!
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

In one of my Sub's this Paste-function only work every second time.
Can you help me to make it work -every- time?

hih:confused:


--
hih
------------------------------------------------------------------------
hih's Profile: http://www.excelforum.com/member.php...o&userid=30672
View this thread: http://www.excelforum.com/showthread...hreadid=503315


DaveO

Works every second time
 
Without seeing the rest of the code, I'm going to guess that the 'Selection.'
part is the bit thats causing you your issue here.

If you post the rest of at least post how the selction is derived it may help.

HTH.

"hih" wrote:


Hello!
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

In one of my Sub's this Paste-function only work every second time.
Can you help me to make it work -every- time?

hih:confused:


--
hih
------------------------------------------------------------------------
hih's Profile: http://www.excelforum.com/member.php...o&userid=30672
View this thread: http://www.excelforum.com/showthread...hreadid=503315



Dave Peterson

Works every second time
 
My guess is that you do something that clears the clipboard.

You could add this to check:

msgbox application.cutcopymode
if it's false, your pastespecial will fail.

Either rearrange the pasting lines in a nice fashion or just copy the original
range before you try pasting again.



hih wrote:

Hello!
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

In one of my Sub's this Paste-function only work every second time.
Can you help me to make it work -every- time?

hih:confused:

--
hih
------------------------------------------------------------------------
hih's Profile: http://www.excelforum.com/member.php...o&userid=30672
View this thread: http://www.excelforum.com/showthread...hreadid=503315


--

Dave Peterson


All times are GMT +1. The time now is 06:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com