Posts by Denis

    Out of interest, should one of those y1 or y2 calculations be minus the square root part of the equation?


    y1 = (-b [b]+[/b] ((-b) ^ 2 - 4 * a * c) ^ 0.5) / (4 * a) 
    y2 = (-b [b]-[/b] ((-b) ^ 2 - 4 * a * c) ^ 0.5) / (4 * a)

    ...and as Chris has stated, it might be nice to return a message box stating if there are no real roots.

    A userform would also be a nicer interface than three inputboxes, if you want to be fancy.

    Right click on one of your data labels and choose "Format Data Labels". (I suggest one of the 0% values) Go to the "Format" tab and change the number of decimal plaves until you get a non-zero value. Press OK.

    Just reread your question, you may also want to change your chart type from a normal pie chart into one of those pie charts that separates the wedges to allow you to more clearly see the slices.

    The syntax that you were looking for to use the sheet names as displayed in the workbook was:

    Set sht = Sheets("Form")
    Set sht = Sheets("SplitData")

    Smozgur's solution uses what is commonly known as the "Code Name" for the worksheet. This is the name of the sheet in parentheses in the VBE project explorer. This is a commonly used technique since it is hard for the common user to change the Code Name.

    Suppose the score that you want to check is in cell A1, then you could use a formula like this:


    there's a bit of a quirk with renaming items using the "name box". When you rename items, you need to hit ENTER after changing the name. If you use the mouse to exit the name box then the new name will not be registered.

    Why? I don't know. Perhaps because <i&gt;they</i&gt; wanted it that way.

    Not fully tested, but you could do something like the following code as well. It uses a named range to hold the address of the last cell to be highlighted, thus it will store what the last cell highlighted was, even if you close the spreadsheet. I've not fully tested it though and similarly to Chris's it will not preserve the color formatting of the cell before it was changed. Although this could easily be fixed.

    Off the top of my head.

    For simple objects and regular polyhedrons, the location of the center of gravity can be determined by inspection. It will always be located on an axis of symmetry. Mathematically you can determine the center of gravity using the statements:

    xc = Integral[x.d.m]/m

    yc = Integral[y.d.m]/m

    zc = Integral[z.d.m]/m


    xc, yc, zc are the axes you are determining

    d is distance from center
    m is mass of object

    Your second code example has no chance of working for numerous reason. The number one reason is that your Case statement makes no sense.
    <pre&gt;Case "A13" To "A100" </pre&gt;

    makes no sense in this instance because "A13" and "A100" are treated as string values and not as ranges. An analogy would be that it would be just as useful as doing a search on a spreadsheet with literally the criteria "Aardvark" to "Zebra" to return all of the animals listed on the sheet.

    Anyway, here's my stab at your code. It's not necessarily pretty, but the problem sounds as though the complete solution is going to be pretty ugly anyway. :D

    Can I ask you what version of Excel you are using. This is the second piece of code today that I've seen "Target As Excel.Range" in the arguments for a worksheet event. (Rather than just "Target As Range")

    Hope this helps

    Or you could have just coded it like this:

    If TextBox2.Value <> "" Then 
      TextBox3 = CLng(TextBox1.Value) + CLng(TextBox2.Value) 
    End If

    Although having "0" in the textbox probably looks nicer.

    I just found a bug. I didn't code in any way to return false and avoid an error in the IsControl function. This code is better, but I am still open to suggestions for improvement because I hate coding in Open, BeforeClose, Activate and Deactivate events.