+ Reply to Thread
Results 1 to 6 of 6

Thread: Editing cells

  1. #1
    Registered User
    Join Date
    03-14-2010
    Location
    Wellington
    MS-Off Ver
    Excel 2007
    Posts
    3

    Editing cells

    Hi All.

    I want to be able to enter a value into a cell (does not matter what value probably an X ) then have the cell display a value based on a calculation of 2 other cells.

    i.e. IF this cell is not empty, multiply 2 values and replace the content in this cell with the result.

    Any idea how to do this?

    I cannot put a formula in the cell directly as when the user enters an X into the cell the formula is errased.

    Regards

    Steve

  2. #2
    Forum Moderator teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    2003 & 2010
    Posts
    10,042

    Re: Editing cells

    Hi smcardle,

    welcome to the forum.

    Excel functions can not replace values in other cells.
    Excel cells hold either values or formulas.

    What you describe above is not doable with functions. Maybe you can post a sample file and explain what you want to achieve in context.

    cheers
    teylyn
    Microsoft MVP - Excel
    At Excelforum, you can say "Thank you!" by clicking the icon below the post.

    Avoid pie charts with more than two data points. Why? See here (pdf, 559 kb). The only acceptable pie chart is here.

  3. #3
    Registered User
    Join Date
    03-14-2010
    Location
    Wellington
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Editing cells

    Hi

    I can't attach a worksheet because I can't do what I am trying to do.

    Let me see if I can explain it a little better.

    I have a range of cells C7 - G10 that I want to apply special handling for.

    I only want the user to be able to either clear the cell or place an X in the cell, sort of an active or non-active status.

    If the user places an X in the cell, I want to replace the X with a calculated value such as
    =C6*B7 and if they clear the cell then just leave it cleared.

    I have 2 possible scenarios:
    1. Do the calculation on leaving each cell
    2. Put a button on the worksheet that does the whole range in one go replacing each cell with an X with a calculated value

    Any idea on how I can achieve this?

    Regards

    Steve

  4. #4
    Forum Moderator teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    2003 & 2010
    Posts
    10,042

    Re: Editing cells

    Attach a worksheet with what you have so far and then let's take it as a starting point.

    So, what formula needs to go into each of the cells in C7 to G10? Is it the same formula for all cells?

    It looks as if you'll require a macro, but without more details about the required outcome, it will be hard to write.
    teylyn
    Microsoft MVP - Excel
    At Excelforum, you can say "Thank you!" by clicking the icon below the post.

    Avoid pie charts with more than two data points. Why? See here (pdf, 559 kb). The only acceptable pie chart is here.

  5. #5
    Registered User
    Join Date
    03-14-2010
    Location
    Wellington
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Editing cells

    Hi.

    I have attached a work sheet for you.

    As you can see the top matrix has a X in each cell I want the user to indicate should have a calculated value.

    The bottom matrix shows the desired result where the values are calculated by multiplying the Weight values in the respective row and column.

    The Value cells are just a SUM of the relevant row and column.

    Hope this helps.


    Regards

    Steve
    Attached Files Attached Files

  6. #6
    Forum Moderator teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    2003 & 2010
    Posts
    10,042

    Re: Editing cells

    OK, try this:

    the code is

    Code:
    Option Explicit
    Sub CalcX()
        Dim cCell As Range
        For Each cCell In Range("C7:H16")
            If cCell.Value = "x" Then
                cCell.Value = Cells(cCell.Row, 2) * Cells(6, cCell.Column)
            End If
        Next cCell
        
    End Sub
    and is assigned to a button. See attached. You must have macros enabled.
    Attached Files Attached Files
    teylyn
    Microsoft MVP - Excel
    At Excelforum, you can say "Thank you!" by clicking the icon below the post.

    Avoid pie charts with more than two data points. Why? See here (pdf, 559 kb). The only acceptable pie chart is here.

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.2.0