+ Reply to Thread
Results 1 to 8 of 8

VBA math formula

  1. #1
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    VBA math formula

    Having a real hard time with this,able to do it in normal excel, this project I'm using vba. Here is a example of what I can not do, if you can give a a formula for this I will be real Happy.
    Thank You
    Attached Files Attached Files
    Last edited by zplugger; 03-13-2009 at 01:52 PM.

  2. #2
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: VBA math formula

    What I’m trying to do is box1 and box2 =sum
    box3 and box4 =sum
    box5 and box6=sum
    sum of what?
    =IF(AND(OR(BLONDE,BRUNETTE,REDHEAD),OR(MY PLACE,HER PLACE),ME),BOW-CHICKA-BOW-WOW,ANOTHER NIGHT ON THE INTERNET)

  3. #3
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: VBA math formula

    Please Login or Register  to view this content.
    That works, took out your "Val" at the end, not too sure what you were trying to do with that. Left the rest of your code as is, not sure the basis for the /12's and the +, *, etc. You didn't explain those so I left them alone.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: VBA math formula

    Try:

    Please Login or Register  to view this content.
    VAL will handle empty textboxes - if blank the code will fail (null is non-numeric)... also if you had something odd like 12 Apples it would use 12.
    Last edited by DonkeyOte; 03-13-2009 at 01:32 PM.

  5. #5
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Thumbs up Re: VBA math formula

    Thank you very much for your time on this, it works great. I'm just learning this stuff and there is a lot of very helpful people here like you. I hope to be able some day to help other people at learning this stuff.

  6. #6
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: VBA math formula

    Yay! I got to learn something too

  7. #7
    Registered User
    Join Date
    12-30-2013
    Location
    malaysia
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: VBA math formula

    hai... can i know where to put VAL for my code below???

    txt7.Value = ((((txt9.Value - txt1.Value) * txt3.Value) - (txt3.Value - 1)) * (txt6.Value - (txt4.Value + txt5.Value)))
    txt11.Value = ((txt8.Value * txt9.Value) * txt10.Value)
    txt1.Value = ((8 * txt11.Value / txt3.Value) / (pi * txt2.Value)) - (4 * txt2.Value * txt2.Value / 3)

  8. #8
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,633

    Re: VBA math formula

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

+ 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