#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Deletions

Using MS Excel 2003

I have 2 workbooks open in my Excel window.

Wb1 catches the exported data from QuickBooksPro (in doing this, QB
overwrites any data that is on a worksheet already, precluding my
dumping the export directly onto my template. Ugh!!

Wb2 is my template and is linked to Wb1 to get the data into the cells
to generate my report from the template without messing with my col/row
headings, formulas etc.

Now, when I close Wb1, I want to delete the ws, which will always be
sheet1. I need help with the syntax on this please.

Then, when I close Wb2, I want to dump all of the linked info so my
template is empty and ready for the next time I need to use it. Again,
this is where I need help with the syntax.

Any guidance you can offer will be much appreciated.
Thanks
Joanne

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Deletions

Hi Joanne

If I understand you right, you don't want to save any of the data in
the two workbooks. Assuming that is right, I would save both workbooks
as templates.

File Save as Save as type choose template.

//Per

On 28 Dec., 20:55, Joanne wrote:
Using MS Excel 2003

I have 2 workbooks open in my Excel window.

Wb1 catches the exported data from QuickBooksPro (in doing this, QB
overwrites any data that is on a worksheet already, precluding my
dumping the export directly onto my template. Ugh!!

Wb2 is my template and is linked to Wb1 to get the data into the cells
to generate my report from the template without messing with my col/row
headings, formulas etc.

Now, when I close Wb1, I want to delete the ws, which will always be
sheet1. I need help with the syntax on this please.

Then, when I close Wb2, I want to dump all of the linked info so my
template is empty and ready for the next time I need to use it. Again,
this is where I need help with the syntax.

Any guidance you can offer will be much appreciated.
Thanks
Joanne


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Deletions

hi
are you going to use WB1 again? If you are you could just close without
saving which would in effect clear the sheet.
another way....
Private Sub Workbook_BeforeClose() 'or BeforeSave()
Sheets("Sheet1").Cells.ClearContents
End Sub
this doesn't delete the sheet, it justs clears all the cells.

as to clearing the template, you will have to do a surgical delete.
Private Sub Workbook_BeforeClose()
Sheets("Sheet1").Range(A1, B2, C3, D4, E5:G10, A5, B6, C7, _
D8, E12:G20, F3, H4).ClearContents
End Sub

The range addresses above were just made up for example purposes only and
have nothing to do with your template. you will have to find all of the range
addresses in your template that you want data cleared out and add them to the
above sample code.

using xp here.
Regards
FSt1
"Joanne" wrote:

Using MS Excel 2003

I have 2 workbooks open in my Excel window.

Wb1 catches the exported data from QuickBooksPro (in doing this, QB
overwrites any data that is on a worksheet already, precluding my
dumping the export directly onto my template. Ugh!!

Wb2 is my template and is linked to Wb1 to get the data into the cells
to generate my report from the template without messing with my col/row
headings, formulas etc.

Now, when I close Wb1, I want to delete the ws, which will always be
sheet1. I need help with the syntax on this please.

Then, when I close Wb2, I want to dump all of the linked info so my
template is empty and ready for the next time I need to use it. Again,
this is where I need help with the syntax.

Any guidance you can offer will be much appreciated.
Thanks
Joanne


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Deletions

Thank you - this info does it for me I think
Joanne

FSt1 wrote:

hi
are you going to use WB1 again? If you are you could just close without
saving which would in effect clear the sheet.
another way....
Private Sub Workbook_BeforeClose() 'or BeforeSave()
Sheets("Sheet1").Cells.ClearContents
End Sub
this doesn't delete the sheet, it justs clears all the cells.

as to clearing the template, you will have to do a surgical delete.
Private Sub Workbook_BeforeClose()
Sheets("Sheet1").Range(A1, B2, C3, D4, E5:G10, A5, B6, C7, _
D8, E12:G20, F3, H4).ClearContents
End Sub

The range addresses above were just made up for example purposes only and
have nothing to do with your template. you will have to find all of the range
addresses in your template that you want data cleared out and add them to the
above sample code.

using xp here.
Regards
FSt1
"Joanne" wrote:

Using MS Excel 2003

I have 2 workbooks open in my Excel window.

Wb1 catches the exported data from QuickBooksPro (in doing this, QB
overwrites any data that is on a worksheet already, precluding my
dumping the export directly onto my template. Ugh!!

Wb2 is my template and is linked to Wb1 to get the data into the cells
to generate my report from the template without messing with my col/row
headings, formulas etc.

Now, when I close Wb1, I want to delete the ws, which will always be
sheet1. I need help with the syntax on this please.

Then, when I close Wb2, I want to dump all of the linked info so my
template is empty and ready for the next time I need to use it. Again,
this is where I need help with the syntax.

Any guidance you can offer will be much appreciated.
Thanks
Joanne



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sumproduct range changing with deletions Steve Excel Worksheet Functions 6 August 4th 08 10:24 PM
Automatic deletions [email protected] Excel Discussion (Misc queries) 7 August 25th 06 07:24 AM
Because of row/column deletions, how do you reset the last cell? AndreaW Excel Discussion (Misc queries) 3 March 23rd 06 06:13 PM
Prevent Worksheet Deletions Karen Excel Worksheet Functions 1 September 12th 05 09:48 PM
Data Form Deletions CyberTaz Excel Discussion (Misc queries) 1 April 26th 05 01:25 PM


All times are GMT +1. The time now is 06:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"