Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2004
    Posts
    10

    Unanswered: if cell is blank, change the value, otherwise do nothing

    Hello,

    I'm new here, and I have a simple question:

    =IF(K7="","15,962",do nothing)

    how do I do the "do nothing" part?

    Thanks,
    JJ

  2. #2
    Join Date
    Jun 2002
    Location
    Houston, TX
    Posts
    116
    Do you want the words? Then just put quotes around it. If you want the answer to be blank type two quotes "" together.

    HTH
    texasalynn

  3. #3
    Join Date
    Mar 2004
    Posts
    10
    Originally posted by texasalynn
    Do you want the words? Then just put quotes around it. If you want the answer to be blank type two quotes "" together.

    HTH
    texasalynn
    Sorry, I should have been more specific.

    I don't want the words or for it to be blank. I am importing data into the worksheet from a database. So I have some defualts I would like to use if the user has neglected to enter the necessary data.

    =IF(K7="","15,962",do nothing)

    So If the data was imported and there is a value, then do nothing.

    Thanks,
    JJ

  4. #4
    Join Date
    Jun 2002
    Location
    Houston, TX
    Posts
    116
    So where are you putting the formula?? It has to have a true and false. Otherwise you can't use and IF statement

    texasalynn

  5. #5
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067
    If you want to put a specific value in the cell's which are blank.
    Then do the following

    write what you want in a blank cell somewhere
    (In your case 15,962)
    copy it
    Highlight the area you want to update the blanks
    Go to Edit -> Go To
    then click the options special cells
    choose the Blanks option
    Click Ok
    then Paste

    this will paste your data into all the blank cells in your area.

    You also could write a Macro to do this Automatically

    Hope this Helps
    David

  6. #6
    Join Date
    Mar 2004
    Posts
    10

    Thanks - I got it to work with this macro

    ' Planned Withdrawals Default to 0
    Sheets("InputData").Select
    Range("d20").Select
    Val = Selection.value
    If Val = "" Then Selection.value = "0"

  7. #7
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067

    Re: Thanks - I got it to work with this macro

    Hi JJay

    Just an idea if you would like it
    you could use this macro to fill all blank cells in column D at once
    if this would Help.

    Code:
    Sub FillBlanks()
        Dim Lastrow As Double
        'Fills Blank Cells with the Value of 0
        
        Worksheets("InputData").Activate
        
        'get Last row of data assume Column A has data on Lastrow
        Lastrow = Range("A65000").End(xlUp).Row
        'fill all blank cells within data range to 0
        Range("D2:D" & Lastrow).SpecialCells(xlCellTypeBlanks).Value = 0
    End Sub
    Ive made 2 Assumptions that Column A has data in the final row of your data.
    and there are no more than 8192 seperate ranges of blank cells in this column.

    David

  8. #8
    Join Date
    Mar 2004
    Posts
    10

    Thanks David - that's good to know

    But my input page has cells scattered around in different sections so it's not a continuous column. Thanks for giving it some thought though. I have about 20 different cells in different areas of the sheet so I just wrote out that small piece of code 20 times and had it run before the rest of the module.

    JJ

  9. #9
    Join Date
    Mar 2004
    Posts
    10

    Thumbs up Re: Thanks - I got it to work with this macro

    How do you rate a member? Yours could use a boost.

Posting Permissions

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