+ Reply to Thread
Results 1 to 4 of 4

Conditionally Fill Cell With Text

Hybrid View

  1. #1
    Registered User
    Join Date
    03-12-2007
    Posts
    16

    Conditionally Fill Cell With Text

    Is it possible...to have a cell contain a formula in which the value within the cell is automatically something if nothing else was manually entered in that specific cell?

    For example, I would want a certain cell to always be "--" if no other value was entered in on the data form. Is there a specific formula/function for this? Perhaps some type of if statement?

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Freezerburn
    Is it possible...to have a cell contain a formula in which the value within the cell is automatically something if nothing else was manually entered in that specific cell?

    For example, I would want a certain cell to always be "--" if no other value was entered in on the data form. Is there a specific formula/function for this? Perhaps some type of if statement?
    Hi,

    One way is to type '-- into the cell, then when you type a figure in that will be overwritten.

    hth
    ---
    Si fractum non sit, noli id reficere.

  3. #3
    Registered User
    Join Date
    03-12-2007
    Posts
    16
    Quote Originally Posted by Bryan Hessey
    Hi,

    One way is to type '-- into the cell, then when you type a figure in that will be overwritten.

    hth
    ---
    That is what I currently am doing, but new rows are inserted into the sheet very often so they don't come "pre-loaded" with the double dash in the cell. I don't think what I asked originally is possible. Thanks anyways!

  4. #4
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Freezerburn
    That is what I currently am doing, but new rows are inserted into the sheet very often so they don't come "pre-loaded" with the double dash in the cell. I don't think what I asked originally is possible. Thanks anyways!
    Hi,

    to cover the insertd single row, or inserted multiple rows, and put '-- in column A of such rows, then on the sheet tab, Rightmouse and select View Code, and paste this code into the sheet displayed.
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rw As Range
    For Each rw In Target.Rows
        With Cells(rw.Row, 1)
        If .Value = "" Then
            .Value = "'--"
            End If
            End With
    Next
    End Sub
    If the column is not A, then change the red number to the number that represents the column (do =Column() in a cell of that column to confirm).

    Let me know how you go
    ---

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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