#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 390
Default Erase Code

I have a spreadsheet that runs code when it opens to populate the data. I
need it to automatically erase the code once complete so that when I save the
workbook with a new name; the code does not rerun when management opens the
workbook to view the data.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Erase Code

Add the routine at the end of your code to

SELECT ALL
COPY
PASTE SPECIAL, VALUES only.

I do not remember the exact coding sequence for above, but if you record a
macro and then do the above steps, Excel will show you what to do.
Sir Metro

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Erase Code

See www.cpearson.com/excel/vbe.htm


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Bill" wrote in message
...
I have a spreadsheet that runs code when it opens to populate
the data. I
need it to automatically erase the code once complete so that
when I save the
workbook with a new name; the code does not rerun when
management opens the
workbook to view the data.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 390
Default Erase Code

I am getting a object not define error. Can you help?

"Chip Pearson" wrote:

See www.cpearson.com/excel/vbe.htm


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Bill" wrote in message
...
I have a spreadsheet that runs code when it opens to populate
the data. I
need it to automatically erase the code once complete so that
when I save the
workbook with a new name; the code does not rerun when
management opens the
workbook to view the data.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Erase Code

You can write an if statement at the beginning of your
code to say something like:

If ActiveWorkbook.Name < "YourWorkbookName.xls" Then
'Code Here
Else
'Other condition code here
End If

You can use = or <.

This way when you change the name of the file, the code
will not run the next time because the workbook name has
changed. Im not sure if leaving this code in the workbook
is exactly what you want, but the reults will be to where
the code will not run.


Todd


-----Original Message-----
I have a spreadsheet that runs code when it opens to

populate the data. I
need it to automatically erase the code once complete so

that when I save the
workbook with a new name; the code does not rerun when

management opens the
workbook to view the data.
.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Erase Code

You need a reference to the extensibility library. In VBA, go to
the Tools menu, choose References, and scroll down until you find
"Microsoft Visual Basic For Applications Extensibility Object
Library". Put a check next to this item.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Bill" wrote in message
...
I am getting a object not define error. Can you help?

"Chip Pearson" wrote:

See www.cpearson.com/excel/vbe.htm


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Bill" wrote in message
...
I have a spreadsheet that runs code when it opens to populate
the data. I
need it to automatically erase the code once complete so
that
when I save the
workbook with a new name; the code does not rerun when
management opens the
workbook to view the data.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Erase Code

Would it be an option to have the code in another file and just manually
start running your program on the main file? or keep the code in the file,
but copy the resultant data over to a new file after your data processing
program completes?

"Todd Huttenstine" wrote:

You can write an if statement at the beginning of your
code to say something like:

If ActiveWorkbook.Name < "YourWorkbookName.xls" Then
'Code Here
Else
'Other condition code here
End If

You can use = or <.

This way when you change the name of the file, the code
will not run the next time because the workbook name has
changed. Im not sure if leaving this code in the workbook
is exactly what you want, but the reults will be to where
the code will not run.


Todd


-----Original Message-----
I have a spreadsheet that runs code when it opens to

populate the data. I
need it to automatically erase the code once complete so

that when I save the
workbook with a new name; the code does not rerun when

management opens the
workbook to view the data.
.


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
want to erase the 0 Darrell_Sarrasin via OfficeKB.com Excel Discussion (Misc queries) 4 September 16th 08 03:24 PM
How to erase a column VBA Jepane Excel Discussion (Misc queries) 2 July 16th 07 02:26 PM
Erase Key in Legend Carlo Charts and Charting in Excel 5 August 30th 06 05:55 PM
Need code to save file to new folder, erase from old folder Ron M. Excel Discussion (Misc queries) 1 February 24th 06 06:02 PM
Erase Duplicates John Excel Worksheet Functions 1 December 7th 05 05:16 PM


All times are GMT +1. The time now is 06:57 PM.

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"