
Signature
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
> I did something very stupid. I deleted a worksheet from a workbook. I
> thought to myself: there are too many worksheets in this workbook.
[quoted text clipped - 5 lines]
>
> Thanks very much
> If you have not saved the file close it without saving, if you have not
> backed up the file other places to look for a copy, have you e-mailed it?
[quoted text clipped - 3 lines]
> computer? Other wise I think it is gone, in the future ALWAYS create backup
> files of your work.
Yeah, I have an older version of the file, but I'll lose a good bit of
work.
I guess that I didn't realize those macros were stored in the worksheet
itself (or didn't think about it until it was too late). Excel says
that data may exist in the worksheet that you are trying to delete.
Maybe it should remind the idiot--I mean user that macros may also
exist. Stupid, stupid me.
Gord Dibben - 22 Sep 2006 00:30 GMT
If all you want back is the worksheet code, you should not have to lose any
work.
Re-name the old workbook, open it and right-click on the sheet tab and "View
Code"
Copy the code from the sheet and paste it into a sheet in the latest book....the
one from which you deleted the "empty" sheet.
Gord Dibben MS Excel MVP
>> If you have not saved the file close it without saving, if you have not
>> backed up the file other places to look for a copy, have you e-mailed it?
[quoted text clipped - 12 lines]
>Maybe it should remind the idiot--I mean user that macros may also
>exist. Stupid, stupid me.
kramer.newsreader@gmail.com - 22 Sep 2006 00:36 GMT
> If all you want back is the worksheet code, you should not have to lose any
> work.
>
> Re-name the old workbook, open it and right-click on the sheet tab and "View
> Code"
Nice idea, but I had already saved the worknook after deleting the
worksheet (as I have a habit of hitting ctrl-s periodically).
> Copy the code from the sheet and paste it into a sheet in the latest book....the
> one from which you deleted the "empty" sheet.
>
> Gord Dibben MS Excel MVP
Gord Dibben - 22 Sep 2006 00:50 GMT
Your post responding to Paul stated.....
>Yeah, I have an older version of the file, but I'll lose a good bit of
>work.
That is the "older" book I am referring to.
Copy the code from there.
Gord
>> If all you want back is the worksheet code, you should not have to lose any
>> work.
[quoted text clipped - 9 lines]
>>
>> Gord Dibben MS Excel MVP
Gord Dibben MS Excel MVP
kramer.newsreader@gmail.com - 22 Sep 2006 00:33 GMT
One more comment for anyone reading this thread. If you write VBA
macros in Excel, it is probably a good idea to save them not in any
particular worksheet, but to save them in the workbook (the little box
that says ThisWorkbook under the VBA editor).
Paul B - 22 Sep 2006 00:41 GMT
It depends on what kind of macro it is, some NEED to be in sheet code and
some in thisworkbook code, as Gord said you should be able to just copy the
code and put in you newer workbook

Signature
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
> One more comment for anyone reading this thread. If you write VBA
> macros in Excel, it is probably a good idea to save them not in any
> particular worksheet, but to save them in the workbook (the little box
> that says ThisWorkbook under the VBA editor).
Gord Dibben - 22 Sep 2006 00:53 GMT
And general macros should be stored in a General Module, not in Thisworkbook
module or in a Worksheet module.
Gord
>It depends on what kind of macro it is, some NEED to be in sheet code and
>some in thisworkbook code, as Gord said you should be able to just copy the
>code and put in you newer workbook