ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Remove VB code from a sheet (https://www.excelbanter.com/excel-programming/390642-remove-vbulletin-code-sheet.html)

IT_roofer

Remove VB code from a sheet
 
I have a few comboboxes on a worksheet and when the user saves the worksheet,
a macro removes all the comboboxes. I was digging through the forum to find a
way to eliminate the code from a worksheet, but I read a post that said it
couldn't be done.

Is that true? If it is not true, where can I find code to eliminate code?

Thanks.

Norman Jones

Remove VB code from a sheet
 
Hi IT_Roofer,

See Chip Pearson at:

Programming To The Visual Basic Editor
http://www.cpearson.com/excel/vbe.htm

See particularly the section entitled:

Deleting A Module From A Workbook

but do read Chip's page introduction in full!



---
Regards,
Norman


"IT_roofer" wrote in message
...
I have a few comboboxes on a worksheet and when the user saves the
worksheet,
a macro removes all the comboboxes. I was digging through the forum to
find a
way to eliminate the code from a worksheet, but I read a post that said it
couldn't be done.

Is that true? If it is not true, where can I find code to eliminate code?

Thanks.




IT_roofer

Remove VB code from a sheet
 
Thank you for your reply. I will dig around on Chip's website, but initially,
the page you pointed me to is not the information I want to find. That page
refers to removing/adding code to a MODULE - I want to remove code from a
WORKSHEET.

Explaination:
I have code in the worksheet that monitor calculations and changes to
certain values and comboboxes and when the sheet is "saved", it is copied to
a new workbook and controls are removed. Well now I would like to apply one
more bit of code to remove the worksheet code when it is copied into the new
workbook.

"Norman Jones" wrote:

Hi IT_Roofer,

See Chip Pearson at:

Programming To The Visual Basic Editor
http://www.cpearson.com/excel/vbe.htm

See particularly the section entitled:

Deleting A Module From A Workbook

but do read Chip's page introduction in full!



---
Regards,
Norman


"IT_roofer" wrote in message
...
I have a few comboboxes on a worksheet and when the user saves the
worksheet,
a macro removes all the comboboxes. I was digging through the forum to
find a
way to eliminate the code from a worksheet, but I read a post that said it
couldn't be done.

Is that true? If it is not true, where can I find code to eliminate code?

Thanks.





IT_roofer

Remove VB code from a sheet
 
Ignore my other post.

I glanced over it and, of course, as soon as I dug into it like I said I was
going to, I now have to eat my words.

Thanks again, Norman.

"Norman Jones" wrote:

Hi IT_Roofer,

See Chip Pearson at:

Programming To The Visual Basic Editor
http://www.cpearson.com/excel/vbe.htm

See particularly the section entitled:

Deleting A Module From A Workbook

but do read Chip's page introduction in full!



---
Regards,
Norman


"IT_roofer" wrote in message
...
I have a few comboboxes on a worksheet and when the user saves the
worksheet,
a macro removes all the comboboxes. I was digging through the forum to
find a
way to eliminate the code from a worksheet, but I read a post that said it
couldn't be done.

Is that true? If it is not true, where can I find code to eliminate code?

Thanks.





Chip Pearson

Remove VB code from a sheet
 
You can remove the code from a sheet module with code like the following. It
will remove the code behind MySheet.

With ThisWorkbook
With .VBProject.VBComponents(.Worksheets("MySheet").Cod eName).CodeModule
.DeleteLines 1, .CountOfLines
End With
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)


"IT_roofer" wrote in message
...
Thank you for your reply. I will dig around on Chip's website, but
initially,
the page you pointed me to is not the information I want to find. That
page
refers to removing/adding code to a MODULE - I want to remove code from a
WORKSHEET.

Explaination:
I have code in the worksheet that monitor calculations and changes to
certain values and comboboxes and when the sheet is "saved", it is copied
to
a new workbook and controls are removed. Well now I would like to apply
one
more bit of code to remove the worksheet code when it is copied into the
new
workbook.

"Norman Jones" wrote:

Hi IT_Roofer,

See Chip Pearson at:

Programming To The Visual Basic Editor
http://www.cpearson.com/excel/vbe.htm

See particularly the section entitled:

Deleting A Module From A Workbook

but do read Chip's page introduction in full!



---
Regards,
Norman


"IT_roofer" wrote in message
...
I have a few comboboxes on a worksheet and when the user saves the
worksheet,
a macro removes all the comboboxes. I was digging through the forum to
find a
way to eliminate the code from a worksheet, but I read a post that said
it
couldn't be done.

Is that true? If it is not true, where can I find code to eliminate
code?

Thanks.








All times are GMT +1. The time now is 09:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com