Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
bookton
 
Posts: n/a
Default How can I protect only format of the cell ?


Any knows how can lock the format of the cell.
I want users can edit the cell but can not change the font, size, color
etc...


--
bookton
------------------------------------------------------------------------
bookton's Profile: http://www.excelforum.com/member.php...o&userid=35481
View this thread: http://www.excelforum.com/showthread...hreadid=552546

  #2   Report Post  
Posted to microsoft.public.excel.misc
Leith Ross
 
Posts: n/a
Default How can I protect only format of the cell ?


Hello Bookton,

Copy this macro code, insert a VBA Module into your project, and paste
the macro. You can run the macro from Excel by pressing ALT+F8 to
display the macro dialog. Select "DisableFormatting" and press the
Enter key. This will prevent the user from changing the cell's format,
and still allow the cell data to be edited.


Code:
--------------------
Sub DisableFormatting()

Dim CmdBar
Dim CmdBarCtrl

'Disable the Formatting toolBar
Excel.CommandBars("Formatting").Enabled = False

Set CmdBar = Excel.CommandBars("Worksheet Menu Bar")

'Disable the controls on the Format Menu
Set CmdBarCtrl = CmdBar.Controls("F&ormat")
With CmdBarCtrl
.Controls("C&ells...").Enabled = False
.Controls("&AutoFormat...").Enabled = False
.Controls("Con&ditional Formatting...").Enabled = False
End With

'Disable the controls on the Edit Menu
Set CmdBarCtrl = CmdBar.Controls("&Edit")
With CmdBarCtrl
.Controls("Cle&ar").Enabled = False
.Controls("F&ill").Enabled = False
.Controls("&Delete...").Enabled = False
End With

'Disable controls on the Right-Click Context Menu
With Excel.CommandBars("Cell")
.Controls("F&ormat cells...").Enabled = False
.Controls("&Insert...").Enabled = False
.Controls("&Delete...").Enabled = False
End With

End Sub

--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=552546

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
In excel how do I protect the format of a cell but let the user c. John Louis Excel Discussion (Misc queries) 11 October 1st 07 01:03 AM
Conditional Format as a MACRO Gunjani Excel Worksheet Functions 3 March 29th 06 06:22 PM
Format of a cell profG Excel Discussion (Misc queries) 1 January 16th 06 04:02 PM
Protect Workbook vs Worksheet?? Dan B Excel Worksheet Functions 3 November 7th 05 10:02 PM
can't format cell - have tried unlocking and unprotecting griffin Excel Discussion (Misc queries) 1 April 5th 05 03:11 AM


All times are GMT +1. The time now is 04:09 AM.

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

About Us

"It's about Microsoft Excel"