Hey guys, I know this has come up alot before and I've done my best to read all of the information on this byt im still gettin trouble here.
this is a part of the code (as of now) that is in the while loop
xlSht has been defined as a sheet in another workbook
indexing stuff is fine, but sometimes (and it seems random) the paste method fails. I was copying rows before but i read on msdn that caused a problem sometimes, but the switch to a range didn't help. Also I can't use pastespecial because im copying potentially massive quantities of data. I also did all the activateing/selecting combinations I could think of to no avail even though I was pretty certain they wouldn't work.
it doesnt seem to hit the same problem at each time, tried clearing memory every iteration but still nothing. its happened to me now on everything from 159 rows to 12700.
this is a part of the code (as of now) that is in the while loop
xlSht has been defined as a sheet in another workbook
indexing stuff is fine, but sometimes (and it seems random) the paste method fails. I was copying rows before but i read on msdn that caused a problem sometimes, but the switch to a range didn't help. Also I can't use pastespecial because im copying potentially massive quantities of data. I also did all the activateing/selecting combinations I could think of to no avail even though I was pretty certain they wouldn't work.
Code:
'if statements check to see if the key is in
If InStr(1, sFilename, key1, vbTextCompare) > 0 Then
'if its the first one, copy header
If cT = 0 Then
xlSht.Range("A1:" & Cells(yT, 26).Address).Copy
Else 'otherwise copy all but header
xlSht.Range("A2:" & Cells(yT, 26).Address).Copy
End If
If yT <> 1 Then
ThisWorkbook.Activate
'activates and does copy/paste operation
Sheets(shtindforadd + 4).Activate
Cells(yV, 1).Select
ThisWorkbook.ActiveSheet.Paste
Application.CutCopyMode = False
'resets yV to bottom with pasted material
yV = yV + yT - cT
cT = 1
End If
Elseif...
it doesnt seem to hit the same problem at each time, tried clearing memory every iteration but still nothing. its happened to me now on everything from 159 rows to 12700.