Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Protect a worksheet but allow cell editing

Hello,

I am new to Excel VBA, and using Excel 2007.

I have a worksheet where I want the user to be able to edit cells (delete,
copy, paste, sort) but **disallow** the ability to unhide columns.

(I use a column for conditional formatting and do not want the user to be
able to see or manipulate this column). (Note: the column that contains the
expression for conditional formatting is on the user data sheet because Excel
will not allow conditional formatting to refer to a cel or cells on another
sheet. :( )

I am struggling with the proper parameter with the .Protection method.
Here's what I have:

With Worksheets("UserData")
.Protect Password:="ThePassword", AllowFormattingColumns:=False,
Contents:=False

End With

I'm either getting the ability to unhide columns and edit data, or cells are
locked from editing and cannot unhide columns.

What am I doing wrong?

Thanks in advance.

--Dan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Protect a worksheet but allow cell editing

Use this instead. Hope this helps! If so, let me know, click "YES" below.

With Worksheets("UserData")
.Protect Password:="ThePassword", DrawingObjects:=False,
Contents:=False
End With

--
Cheers,
Ryan


"Dan" wrote:

Hello,

I am new to Excel VBA, and using Excel 2007.

I have a worksheet where I want the user to be able to edit cells (delete,
copy, paste, sort) but **disallow** the ability to unhide columns.

(I use a column for conditional formatting and do not want the user to be
able to see or manipulate this column). (Note: the column that contains the
expression for conditional formatting is on the user data sheet because Excel
will not allow conditional formatting to refer to a cel or cells on another
sheet. :( )

I am struggling with the proper parameter with the .Protection method.
Here's what I have:

With Worksheets("UserData")
.Protect Password:="ThePassword", AllowFormattingColumns:=False,
Contents:=False

End With

I'm either getting the ability to unhide columns and edit data, or cells are
locked from editing and cannot unhide columns.

What am I doing wrong?

Thanks in advance.

--Dan

  #3   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Protect a worksheet but allow cell editing

I can still unhide the columns after the code runs.

"Ryan H" wrote:

Use this instead. Hope this helps! If so, let me know, click "YES" below.

With Worksheets("UserData")
.Protect Password:="ThePassword", DrawingObjects:=False,
Contents:=False
End With

--
Cheers,
Ryan


"Dan" wrote:

Hello,

I am new to Excel VBA, and using Excel 2007.

I have a worksheet where I want the user to be able to edit cells (delete,
copy, paste, sort) but **disallow** the ability to unhide columns.

(I use a column for conditional formatting and do not want the user to be
able to see or manipulate this column). (Note: the column that contains the
expression for conditional formatting is on the user data sheet because Excel
will not allow conditional formatting to refer to a cel or cells on another
sheet. :( )

I am struggling with the proper parameter with the .Protection method.
Here's what I have:

With Worksheets("UserData")
.Protect Password:="ThePassword", AllowFormattingColumns:=False,
Contents:=False

End With

I'm either getting the ability to unhide columns and edit data, or cells are
locked from editing and cannot unhide columns.

What am I doing wrong?

Thanks in advance.

--Dan

  #4   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Protect a worksheet but allow cell editing

Sometimes Obvious is so hard to find...

Select the range I want the user to be able to change...
<format Cels<Protection Uncheck <Locked

Then run the code:

With Worksheets("UserData")
.Protect Password:="ThePassword"
End With

(I feel silly.)
--Dan

"Ryan H" wrote:

Use this instead. Hope this helps! If so, let me know, click "YES" below.

With Worksheets("UserData")
.Protect Password:="ThePassword", DrawingObjects:=False,
Contents:=False
End With

--
Cheers,
Ryan


"Dan" wrote:

Hello,

I am new to Excel VBA, and using Excel 2007.

I have a worksheet where I want the user to be able to edit cells (delete,
copy, paste, sort) but **disallow** the ability to unhide columns.

(I use a column for conditional formatting and do not want the user to be
able to see or manipulate this column). (Note: the column that contains the
expression for conditional formatting is on the user data sheet because Excel
will not allow conditional formatting to refer to a cel or cells on another
sheet. :( )

I am struggling with the proper parameter with the .Protection method.
Here's what I have:

With Worksheets("UserData")
.Protect Password:="ThePassword", AllowFormattingColumns:=False,
Contents:=False

End With

I'm either getting the ability to unhide columns and edit data, or cells are
locked from editing and cannot unhide columns.

What am I doing wrong?

Thanks in advance.

--Dan

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
Can I protect cell numbering format ($) but allow editing? Deb22 Excel Discussion (Misc queries) 6 September 22nd 09 07:37 AM
Can I protect a format but allow editing in cells? Custy Excel Discussion (Misc queries) 1 March 20th 09 02:39 AM
How to protect few cells of the worksheet from editing?and few other doubts also plz help divya Excel Programming 10 July 12th 06 08:31 AM
How can I protect a worksheet yet allow editing in Excel 2000 jimar Excel Discussion (Misc queries) 1 August 26th 05 11:25 AM
Protect sheets from editing but allowing macro to do so? NooK[_52_] Excel Programming 5 August 5th 04 03:55 PM


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