Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Use VB code to remove code in sheet1

I can't seem to find anything that works to remove code from Sheet1 or for
that matter any modules

I have a procedure and am going to send the finished sheet but want to strip
the code with a routine I followed instructions in a book but it doesnt seem
to work.
Any help appreciated
Jeff




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Use VB code to remove code in sheet1

Jeff,

Try something like the following:

With ThisWorkbook
With .VBProject.VBComponents( _
.Worksheets("Sheet1").CodeName).CodeModule
.DeleteLines 1, .CountOfLines
End With
End With

See www.cpearson.com/excel/vbe.htm for more details.


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





"WashoeJeff" wrote in message
...
I can't seem to find anything that works to remove code from

Sheet1 or for
that matter any modules

I have a procedure and am going to send the finished sheet but

want to strip
the code with a routine I followed instructions in a book but

it doesnt seem
to work.
Any help appreciated
Jeff




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the

World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Use VB code to remove code in sheet1

Jeff,

Sub test()
Dim strCodeName As String

strCodeName = Worksheets("My Sheet 1").CodeName
With ThisWorkbook.VBProject.VBComponents(strCodeName).C odeModule
If .CountOfLines 0 Then .DeleteLines 1, .CountOfLines
End With
End Sub

You could have problems running this under Excel 2002 with the security
features. Recommend investigating 'trusted code' options if this is a
problem.

Rob


"WashoeJeff" wrote in message
...
I can't seem to find anything that works to remove code from Sheet1 or for
that matter any modules

I have a procedure and am going to send the finished sheet but want to

strip
the code with a routine I followed instructions in a book but it doesnt

seem
to work.
Any help appreciated
Jeff




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Use VB code to remove code in sheet1

using the code I get a subscript out of range error

Jeff

"Chip Pearson" wrote in message
...
Jeff,

Try something like the following:

With ThisWorkbook
With .VBProject.VBComponents( _
.Worksheets("Sheet1").CodeName).CodeModule
.DeleteLines 1, .CountOfLines
End With
End With

See www.cpearson.com/excel/vbe.htm for more details.


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





"WashoeJeff" wrote in message
...
I can't seem to find anything that works to remove code from

Sheet1 or for
that matter any modules

I have a procedure and am going to send the finished sheet but

want to strip
the code with a routine I followed instructions in a book but

it doesnt seem
to work.
Any help appreciated
Jeff




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the

World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----







-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Use VB code to remove code in sheet1

Opps sorry
It worked when I changed the name to the sheet name instead of sheet 1

Thank you

Jeff

"Chip Pearson" wrote in message
...
Jeff,

Try something like the following:

With ThisWorkbook
With .VBProject.VBComponents( _
.Worksheets("Sheet1").CodeName).CodeModule
.DeleteLines 1, .CountOfLines
End With
End With

See www.cpearson.com/excel/vbe.htm for more details.


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





"WashoeJeff" wrote in message
...
I can't seem to find anything that works to remove code from

Sheet1 or for
that matter any modules

I have a procedure and am going to send the finished sheet but

want to strip
the code with a routine I followed instructions in a book but

it doesnt seem
to work.
Any help appreciated
Jeff




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the

World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----







-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
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
remove password on VBA code Tom Excel Discussion (Misc queries) 1 February 13th 10 06:36 AM
VBA Code Required for deleting All Sheets except Sheet1 Ms-Exl-Learner Excel Discussion (Misc queries) 7 November 3rd 09 10:19 AM
code is not to work on sheet1 Allan R Jeffery New Users to Excel 3 August 22nd 06 02:22 PM
How do I color code the "SHEET1" Tab in Excel? kmtg Excel Worksheet Functions 3 June 14th 06 04:13 PM
Remove VBA code Michi[_2_] Excel Programming 3 January 21st 04 04:18 PM


All times are GMT +1. The time now is 08:44 PM.

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

About Us

"It's about Microsoft Excel"