Look at this part right here:
Rich (BB code):
omszrange.Rows(rownum).Copy
You are telling it to copy the
entire row! That will copy columns
A - XFD, which is a total of
16384 columns!
It is important to note that column XFD (or column number 16384) is the last possible column you are allowed in Excel.
However, if you are trying to paste the entire row, starting in column C, like you are doing here:
Rich (BB code):
Workbooks(Filename2.Cells(i, 1)).Worksheets(Tabname3.Cells(i, 1)).Range("C63").PasteSpecial Paste:=xlPasteValues
that would try to paste to to columns
3-16386 (because it MUST be the exact same size as the original range you are copying, which 16384 columns).
However, you cannot go past 16384, since that is the last column you are allowed to have in Excel.
Hence, you get an error.
Its like if you have a 10 foot board and a 10 foot hole. But you want to leave a 1 foot gap from the one side. The board won't fit in the hole because it is too long if you try to leave a gap. That is what is happenning here.
You either need to:
- Paste the results in column A so that you use every single column
or
- Shorten the number of columns you are copying, so you are not copying every single column in the row
I think you are getting hung up on nomenclature. In VBA "row" means the "entire row".
If you want to just copy certain columns, you need to specify the exact columns you want to copy in your range (and not use "rows").
If you tell us exactly what that is, we can help you edit that part of your code.