I've been fooling around with vba lately and have run into an error i cant quite figure out. Basically i have a workbook with a bunch of sheets and im using vba to insert data and such. I have a piece of code that i wanted to use to open another excel file and copy/paste the data into my big workbook. Now, the code works FINE when i run it from a form. I have a button on my form, "insert data", push it, it opens the excel document, copies and pastes the data into my workbook, then closes the excel document. But, when i use that same code on the sheet in the workbook and just run the macro i get an error and a popup that just says "400".
when i use the debug feature and step into the macro it fails on the "range" line and gives me a run-time error 1004. code is below.
Like i said, when i run this code from a form on my workbook it runs perfectly. when i put it in the sheet though (which is the dsc sheet) i get an error... and it's the same code. Any ideas?? Obviously the code is fine, it works. So why would i get an error when putting it on a sheet compared to running it on a form??Please Login or Register to view this content.
Jason
ps - i want to eliminate using a form, why im asking. i only had a form built for testing purposes. this is just a piece of a project im working on, want to tie it into some other things.
Bookmarks