locked
VBA Office 2010 RRS feed

  • Question

  • Hello

    I programed an calculator (Binome) in a frame

    it works, but I can't show the result on Exel Tabel ( ActiveCell)

    I placed a Button to do that in the frame

    here the code for the calculation

    Private Sub CommandButton2_Click()


    Dim Wert1 As Double
    Dim Wert2 As Double
    Dim Wert3 As Double
    Wert1 = TextBox1.Text
    Wert2 = TextBox3.Text
    Wert3 = Wert1 * Wert1 + 2 * Wert1 * Wert2 + Wert2 * Wert2
    TextBox4.Text = Wert3

    End Sub

    that's the problem.....

    Private Sub CommandButton4_Click()
        Dim Wert3 As Double
       
           With Worksheets("Tabelle1")
           ActiveCell.Show = Wert3
           End With
    End Sub

    I do here some mistakes, be happy somebody help me

    thank you...........  Rolf

     

    • Moved by Cindy Meister MVP Saturday, November 27, 2010 9:24 AM not VSTO-related (From:Visual Studio Tools for Office)
    Friday, November 26, 2010 7:02 PM

Answers

  • Hi

    Try changing

    ActiveCell.Show = Wert3

    to

    Activecell.value = val(TextBox4.Text)

    As you don't need wert3 in thes last procedure you could also remove Dim Wert3 as double

    Hope this helps


    G North MMI
    • Proposed as answer by Bruce Song Wednesday, December 1, 2010 10:16 AM
    • Marked as answer by Bruce Song Wednesday, December 8, 2010 2:08 AM
    Saturday, November 27, 2010 11:00 AM
  • hello

    if you wrote   ActiveCell.Value = Val(TextBox4.Text) you can't show in the Range on Exel

    00,00 that's not Double  (Val=200 without point(comma))

    you have to convert it to Double  so ActiveCell.Value = CDbl(TextBox4.Text)

    it will show at the Range 00.00 VBA not know "Decimal" like VS

    greetings Rolf

    • Marked as answer by Bruce Song Wednesday, January 5, 2011 1:53 AM
    Tuesday, January 4, 2011 4:59 PM

All replies

  • Hi

    Try changing

    ActiveCell.Show = Wert3

    to

    Activecell.value = val(TextBox4.Text)

    As you don't need wert3 in thes last procedure you could also remove Dim Wert3 as double

    Hope this helps


    G North MMI
    • Proposed as answer by Bruce Song Wednesday, December 1, 2010 10:16 AM
    • Marked as answer by Bruce Song Wednesday, December 8, 2010 2:08 AM
    Saturday, November 27, 2010 11:00 AM
  • Hi Rolfxxx,

    I am writing to check the status of the issue on your side. Could you please let us know if the suggestions help you or not? If you have any concerns or questions, please feel free to let us know. We will be more than happy to be of assistance.

    Best Regards,

    Bruce Song


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, December 1, 2010 5:53 AM
  • Sorry, but I get now feedback from the Alert ,what I have set...

    thank's for the help    greetings  Rolf

    Friday, December 10, 2010 11:14 AM
  • hi the syntax didn't work

    I have placed a button on the worksheet(sheet1) to open the calculator, if I get an result at the calculater the frame have to show it on a

    exel worksheet in a cell

    well I found the solution here the code button4 show the result at cell D10 sheet1

    Private Sub CommandButton1_Click()
    Unload Me

    End Sub

     


    Private Sub CommandButton2_Click()


    Dim Wert1 As Double
    Dim Wert2 As Double
    Dim Wert3 As Double
    Wert1 = TextBox1.Text
    Wert2 = TextBox3.Text
    Wert3 = Wert1 * Wert1 + 2 * Wert1 * Wert2 + Wert2 * Wert2
    TextBox4.Text = Wert3

    End Sub

     

    Private Sub CommandButton3_Click()
    TextBox1 = ""
    TextBox3 = ""
    TextBox4 = ""

       
    End Sub

     

     

    Private Sub CommandButton4_Click()
        Unload Me
    Worksheets("Tabelle1").Activate
    Sheets("Tabelle1").Range("D10").Select
    ActiveCell.Value = Val(TextBox4.Text)
    End Sub

    Private Sub UserForm_Click()

    End Sub

     

    Monday, January 3, 2011 7:30 PM
  • hello

    if you wrote   ActiveCell.Value = Val(TextBox4.Text) you can't show in the Range on Exel

    00,00 that's not Double  (Val=200 without point(comma))

    you have to convert it to Double  so ActiveCell.Value = CDbl(TextBox4.Text)

    it will show at the Range 00.00 VBA not know "Decimal" like VS

    greetings Rolf

    • Marked as answer by Bruce Song Wednesday, January 5, 2011 1:53 AM
    Tuesday, January 4, 2011 4:59 PM