Hi

I'm running a macro that sorts, filters and formats some source data - until now my results have shown in the same workbook as the macro is running from, but I've found it more handy (and a lot of harddrive space saving), if my results appeared in a new workbook.

I used the macro recorder to try to get a clue of what to do, but it only gave me more questions;

I'm using a commandbutton to execute the code. The first time it is run it should generate a new workbook and paste the results in there, however the second time it is run it shouldn't create a new workbook (since it has already been created), but merely copy the results into two new sheets. Something like;

VB Code:
  1. if not workbook("book1") exists then
  2. workbook.add
  3. 'code
  4. else
  5. 'code
  6. end if

any ideas? bet there is a dead easy solution