I am relatively new to VBA and have run into a problem i can not solve through tinkering of the code or searching of the web.
Run-time error '1004':
Application-defined or object-defined error
To summarize. I am trying to copy a column of undefined length starting at cell A1 from one workbook, to another workbook starting at a known cell.
The variables may need clarifying, here is an index
prefix$-------used to define the workbook
currentdate,--used to define the workbook
year----------used to define the workbook
numrows----the number of used rows on the workbook being
copied to. I am trying to copy the column to the
workbook at cell(numrows + 1, A)
I have done everything in know to do to get this code to function properly
the problem section is pasted below. I will provide more code if necessary. The line in red generates the error
numrows = Workbooks("ML_" & year & ".xls").Worksheets(1).Rows.Count
Workbooks(prefix$ & currentdate & ".xls").Worksheets(1).Range("A").Copy
Workbooks("ML_" & year & ".xls").Worksheets(1).Cells(numrows + 1, 1).Paste
Run-time error '1004':
Application-defined or object-defined error
To summarize. I am trying to copy a column of undefined length starting at cell A1 from one workbook, to another workbook starting at a known cell.
The variables may need clarifying, here is an index
prefix$-------used to define the workbook
currentdate,--used to define the workbook
year----------used to define the workbook
numrows----the number of used rows on the workbook being
copied to. I am trying to copy the column to the
workbook at cell(numrows + 1, A)
I have done everything in know to do to get this code to function properly
the problem section is pasted below. I will provide more code if necessary. The line in red generates the error
numrows = Workbooks("ML_" & year & ".xls").Worksheets(1).Rows.Count
Workbooks(prefix$ & currentdate & ".xls").Worksheets(1).Range("A").Copy
Workbooks("ML_" & year & ".xls").Worksheets(1).Cells(numrows + 1, 1).Paste