problem with excel vba copy/paste. can anyone help?

V

vbadude

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?
 
T

Tom Ogilvy

'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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top