ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   problem with excel vba copy/paste. can anyone help? (https://www.excelbanter.com/excel-programming/377946-problem-excel-vba-copy-paste-can-anyone-help.html)

vbadude

problem with excel vba copy/paste. can anyone help?
 
i get an inconsistent error... more like a fluke.... that happens once in a
blue moon.
The code below results in an incomplete paste. Only the 1st cell is pasted
and the rest are blank?!!!

'copy
dataWS.Activate
Set xlrng = dataWS.Range(dataWS.Cells(Row, 5), dataWS.Cells(Row, 256))
xlrng.Select
Application.CutCopyMode = False
Selection.Copy

'paste
xlws.Activate
xlws.Cells(writerow, 1).Select
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Ideas anyone?

Tom Ogilvy

problem with excel vba copy/paste. can anyone help?
 
'copy
dataWS.Activate
Set xlrng = dataWS.Range(dataWS.Cells(Row, 5), dataWS.Cells(Row, 256))
xlrng.Select
Application.CutCopyMode = False
Selection.Copy
'paste
xlws.Activate
xlws.Cells(writerow, 1).Select
On Error Resume Next
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
' if err.Number < 0 then
' msgbox "Selection can not be pasted"
' end if
on Error goto 0

--
Regards,
Tom Ogilvy


"vbadude" wrote:

i get an inconsistent error... more like a fluke.... that happens once in a
blue moon.
The code below results in an incomplete paste. Only the 1st cell is pasted
and the rest are blank?!!!

'copy
dataWS.Activate
Set xlrng = dataWS.Range(dataWS.Cells(Row, 5), dataWS.Cells(Row, 256))
xlrng.Select
Application.CutCopyMode = False
Selection.Copy

'paste
xlws.Activate
xlws.Cells(writerow, 1).Select
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Ideas anyone?



All times are GMT +1. The time now is 05:40 PM.

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