Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
al al is offline
external usenet poster
 
Posts: 363
Default Need help with locking columns

I am trying to lock columns A, F, and H on Sheet1 so that when a user opens
the workbook, these 3 columns are locked for any editing, however, I want the
user to be able to edit any thing else on the sheet. I need help with the
code.
thanks
Al
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Need help with locking columns

Al,

Try this. Select all cells by clicking the box above the 1 of row 1. Right
click anywhere on the sheet

Format Cells - Protection Tab and un-check 'Locked' - OK

Select your 3 columns by holding down CTRL and clicking on the column header
of each column

Right click in one of the selected columns and repeat the formatting but
this time check 'Locked' - OK

Protect the sheet and your done.

Mike

"Al" wrote:

I am trying to lock columns A, F, and H on Sheet1 so that when a user opens
the workbook, these 3 columns are locked for any editing, however, I want the
user to be able to edit any thing else on the sheet. I need help with the
code.
thanks
Al

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Need help with locking columns

You can run this code, but you really don't have too. I would just select
the Columns A,F,H and righ click, then select Format Cells, click Protection,
ensure locked cells has a check mark in it. The protect the sheet and save,
you are then done!

Sub LockColumns()

' protect worksheet
ActiveSheet.Unprotect Password:="password"

' unlock all cells
Cells.Locked = False

' lock Columns A,F,H
Range("A:A,F:F,H:H").Locked = True

' protect worksheet
ActiveSheet.Protect Password:="password"
End Sub

--
Cheers,
Ryan


"Al" wrote:

I am trying to lock columns A, F, and H on Sheet1 so that when a user opens
the workbook, these 3 columns are locked for any editing, however, I want the
user to be able to edit any thing else on the sheet. I need help with the
code.
thanks
Al

  #4   Report Post  
Posted to microsoft.public.excel.programming
al al is offline
external usenet poster
 
Posts: 363
Default Need help with locking columns

Thank you Mike and Ryan both ways work, I just wanted to learn how to code it
as well.

"Ryan H" wrote:

You can run this code, but you really don't have too. I would just select
the Columns A,F,H and righ click, then select Format Cells, click Protection,
ensure locked cells has a check mark in it. The protect the sheet and save,
you are then done!

Sub LockColumns()

' protect worksheet
ActiveSheet.Unprotect Password:="password"

' unlock all cells
Cells.Locked = False

' lock Columns A,F,H
Range("A:A,F:F,H:H").Locked = True

' protect worksheet
ActiveSheet.Protect Password:="password"
End Sub

--
Cheers,
Ryan


"Al" wrote:

I am trying to lock columns A, F, and H on Sheet1 so that when a user opens
the workbook, these 3 columns are locked for any editing, however, I want the
user to be able to edit any thing else on the sheet. I need help with the
code.
thanks
Al

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Need help with locking columns

Hey Al! Do me a favor and click "YES" next to "Was this post helpful to
you?". I'm trying to get my silver icon.


--
Cheers,
Ryan


"Al" wrote:

Thank you Mike and Ryan both ways work, I just wanted to learn how to code it
as well.

"Ryan H" wrote:

You can run this code, but you really don't have too. I would just select
the Columns A,F,H and righ click, then select Format Cells, click Protection,
ensure locked cells has a check mark in it. The protect the sheet and save,
you are then done!

Sub LockColumns()

' protect worksheet
ActiveSheet.Unprotect Password:="password"

' unlock all cells
Cells.Locked = False

' lock Columns A,F,H
Range("A:A,F:F,H:H").Locked = True

' protect worksheet
ActiveSheet.Protect Password:="password"
End Sub

--
Cheers,
Ryan


"Al" wrote:

I am trying to lock columns A, F, and H on Sheet1 so that when a user opens
the workbook, these 3 columns are locked for any editing, however, I want the
user to be able to edit any thing else on the sheet. I need help with the
code.
thanks
Al

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
Locking columns Shannan Excel Discussion (Misc queries) 3 September 24th 09 06:12 PM
Locking Columns in excel gueyo Excel Worksheet Functions 2 April 24th 09 04:11 PM
Locking columns Sherry Excel Discussion (Misc queries) 1 June 24th 08 08:14 PM
Locking columns chefatl Excel Discussion (Misc queries) 1 March 16th 06 12:20 AM
Locking down columns TripleT Excel Programming 3 February 19th 04 10:05 PM


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