Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GUS GUS is offline
external usenet poster
 
Posts: 45
Default put zero value to unprotected cells

How can i put with a macro the zero(0.00) value to all cells that are
unprotected .

The range that i am working and it is protected is
c4 to m102
not all cells of course are protected



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default put zero value to unprotected cells

if ActiveSheet.ProtectContents then
ActiveSheet.Protect UserInterfaceOnly:=True
End if
for each cell in range("C4:M102")
if cell.locked = False then
cell.Value = 0
cell.Numberformat = "0.00"
end if
Next

if using xl2002, and the sheet is protected and has a password, you will
need to supply the password as well.

--
Regards,
Tom Ogilvy

GUS wrote in message
...
How can i put with a macro the zero(0.00) value to all cells that are
unprotected .

The range that i am working and it is protected is
c4 to m102
not all cells of course are protected





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default put zero value to unprotected cells

GUS

Selection.NumberFormat = "0.00" should read..

cell.NumberFormat = "0.00"

To prevent losing formatting on Locked cells.

Gord

On Sun, 14 Sep 2003 14:46:06 -0700, Gord Dibben wrote:

GUS

Sub UnLocked_Cells()
Dim cell As Range
For Each cell In Selection
If Not cell.Locked Then
Selection.NumberFormat = "0.00"
cell.Value = "0"
End If
Next cell
End Sub

Gord Dibben Excel MVP XL2002

On Sun, 14 Sep 2003 23:47:19 +0300, "GUS" wrote:

How can i put with a macro the zero(0.00) value to all cells that are
unprotected .

The range that i am working and it is protected is
c4 to m102
not all cells of course are protected



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
Unprotected cells Mainer Excel Worksheet Functions 2 October 13th 09 02:37 AM
tab between unprotected cells LesaT Excel Discussion (Misc queries) 1 November 3rd 05 11:30 PM
Formatting on unprotected cells MargaretAnnM Excel Discussion (Misc queries) 1 October 21st 05 12:22 AM
Modifying UnProtected Cells Gladys Excel Discussion (Misc queries) 3 July 27th 05 02:39 PM
Unprotected cells after a download Pdek Excel Discussion (Misc queries) 0 May 8th 05 04:38 PM


All times are GMT +1. The time now is 03:41 AM.

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"