Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Zero Default

Not as a default, but you could use an event macro that looks at the cell after
the change and if it's empty, it changes the cell to 0.

If you want to try, right click on the worksheet tab that should have that
behavior and select view code. Paste this into the code window that just
opened:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myCell As Range
Dim myRng As Range

Set myRng = Me.Range("a1:b99") 'whatever range should be checked

If Intersect(Target, myRng) Is Nothing Then Exit Sub

On Error Resume Next
Application.EnableEvents = False
For Each myCell In Intersect(Target, myRng).Cells
If myCell.Value = "" Then
myCell.Value = 0
End If
Next myCell
Application.EnableEvents = True
On Error GoTo 0

End Sub


Macros have to be enabled for this to work. And change the range (I used
A1:B99) to what you need.

Please help James wrote:

Is there any way that I can make each cell a zero default, so that whenever a
number is deleted within a cell, it reverts back to zero. Thanks!


--

Dave Peterson
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
Default Windows Profile without default Office user info Karen Excel Discussion (Misc queries) 0 November 12th 08 04:53 PM
Default ribbon to open by default when opening xls in browser Hank Excel Discussion (Misc queries) 0 April 10th 08 10:12 PM
0 As Default Value Irfan Excel Worksheet Functions 1 April 1st 08 04:34 PM
Default Set up Gor_yee Excel Discussion (Misc queries) 6 January 8th 07 11:46 AM
default value hustla7 Excel Discussion (Misc queries) 8 August 19th 06 07:17 PM


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