Results 1 to 6 of 6

Set Default Value

Threaded View

HangMan Set Default Value 09-11-2013, 06:06 AM
:) Sixthsense :) Re: Set Default Value 09-11-2013, 06:23 AM
HangMan Re: Set Default Value 09-11-2013, 06:30 AM
:) Sixthsense :) Re: Set Default Value 09-11-2013, 06:35 AM
hb316 Re: Set Default Value 09-11-2013, 07:18 AM
hb316 Re: Set Default Value 09-11-2013, 08:00 AM
  1. #1
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Set Default Value

    I have a column where I want to set a default value for every cell of 0.00. I want the user to be able to enter a value in any cell, but if the user changes their mind and deletes a value from any cell, the value in that cell should default back to 0.00 rather than appear blank.

    I came across this code, which almost works, but I'm unsure how to adapt it so that it will apply to any cell where the user deletes a value, rather than just the first cell (A2). My VBA is limited but I'm sure it is probably an easy tweak, I'm just not sure how to do it? At the moment any deleted values (see attached) will only be restored to the default 0.00 if the value in cell A2 is deleted, but it needs to work for all cells.

    Many thanks

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Range("A2:A18")) Is Nothing Then
        If Range("A2").Value = "" Then
        Range("A2:A18").Value = 0#
        End If
    End If
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Save As Dialog Box - Default Path and File Name, User Selects Sub Folder from Default Path
    By christenprochaska in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2012, 05:17 PM
  2. Always default to $
    By LRamsay in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-08-2008, 07:06 PM
  3. Replies: 2
    Last Post: 11-17-2008, 09:14 PM
  4. default value
    By hustla7 in forum Excel General
    Replies: 8
    Last Post: 08-19-2006, 02:17 PM
  5. Replies: 0
    Last Post: 03-11-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1