Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default Column Delete

Hi
I created this simple macro through use of the recorder...

Private Sub commandbutton4_click()

Columns(ActiveCell.Column).Delete

End Sub

It works fine, but I would like to protect Col 1:3 from being deleted. I
would also like to add worksheet protection but the code wont run if the
sheet is protected and if I add Unprotect to the code then Col 1:3 would
still be able to be deleted. How can I modify to accomplish this.
Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Column Delete


Private Sub commandbutton4_click()

If Activecell.Column 3 then Columns(ActiveCell.Column).Delete

End Sub


"Henry" wrote:

Hi
I created this simple macro through use of the recorder...

Private Sub commandbutton4_click()

Columns(ActiveCell.Column).Delete

End Sub

It works fine, but I would like to protect Col 1:3 from being deleted. I
would also like to add worksheet protection but the code wont run if the
sheet is protected and if I add Unprotect to the code then Col 1:3 would
still be able to be deleted. How can I modify to accomplish this.
Thanks!

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
Copy column header to next column, delete & delete every nth colum genehunter New Users to Excel 1 June 2nd 09 03:57 PM
delete cells column. Delete empty cells myshak Excel Worksheet Functions 0 March 9th 09 10:59 PM
Look for value in a column and delete Tempy Excel Programming 11 April 20th 05 03:02 PM
Delete All Rows That Column A value is not in Column A of Sheet2 [email protected] Excel Programming 2 September 3rd 04 09:13 PM
Delete a Row if a Certain Value is in Column C John Excel Programming 10 June 13th 04 01:03 PM


All times are GMT +1. The time now is 04:34 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"