Retrieve Deleted Worksheet

K

kramer.newsreader

I did something very stupid. I deleted a worksheet from a workbook. I
thought to myself: there are too many worksheets in this workbook.
That one is blank, so I'll delete it. Unfortunately, there are some
important macros stored in that worksheet and I don't have another copy
of them.

Is there any way to retrieve them?

Thanks very much
 
P

Paul B

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?
May be a copy in your sent items folder, if file was on a network server it
probably makes backups at sometime, check with you IT person, have you gave
the file to someone else that might have a copy of it? Copy on another
computer? Other wise I think it is gone, in the future ALWAYS create backup
files of your work.

--
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
 
K

kramer.newsreader

Paul said:
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?
May be a copy in your sent items folder, if file was on a network server it
probably makes backups at sometime, check with you IT person, have you gave
the file to someone else that might have a copy of it? Copy on another
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.
 
G

Gord Dibben

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
 
K

kramer.newsreader

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).
 
K

kramer.newsreader

Gord said:
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).
 
P

Paul B

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

--
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
 
G

Gord Dibben

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

Nice idea, but I had already saved the worknook after deleting the
worksheet (as I have a habit of hitting ctrl-s periodically).

Gord Dibben MS Excel MVP
 
G

Gord Dibben

And general macros should be stored in a General Module, not in Thisworkbook
module or in a Worksheet module.


Gord
 
Top