Is this possible???

joy_666

Board Regular
Joined
Dec 10, 2008
Messages
121
Hi,

I want to put a default value in column C, say from C2-C100.

I want the default value as 0.00.

What I want is that it should let the user key in any value greater than 0.00 but shouldn't let the user leave the cell as blank.(shouldn't let the user to delete the 0.00)

Is this possible?????

I have used all the options in validation but it doesn't help.......

Any suggestions?!?!??
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Create a template with C2:C100 filled with the format/number you want (in this case Number with 2 decimal points, and 0.00), and then set cell validation to require a number. Save that as a template, and presto!
 
Upvote 0
Greetings Joy,

This is a worksheet event, so must be stored in the sheet's module.

Right-Click the tab of the sheet you want this in, and select View Code.

Paste code in VBIDE.

Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rCell As Range
    '// Identify the range that we want to alter what's being changed.      //
    If Not Application.Intersect(Range("C2:C100"), Target) Is Nothing Then
        '// Optional: to insist on number format
        Target.NumberFormat = "0.00"
 
        '// If just one cell is being changed...                            //
        If Not Target.Count > 1 Then
            If Target.Value = vbNullString Then
                Target.Value = 0
            End If
        '// Else if a bunch o' cells are changing.                          //
        Else
            For Each rCell In Target
                If rCell.Value = vbNullString Then
                    rCell.Value = 0
                End If
            Next
        End If
    End If
End Sub

Hope this helps,

Mark
 
Upvote 0

Forum statistics

Threads
1,214,869
Messages
6,122,015
Members
449,060
Latest member
LinusJE

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top