+ Reply to Thread
Results 1 to 15 of 15

Can't work calculation?

  1. #1
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Can't work calculation?

    Hi,

    I'm trying take the first letter from combobox10, divide by 2 and put the result in textbox27>

    Any ideas??





    Please Login or Register  to view this content.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,474

    Re: Can't work calculation?

    Well, I don't understand VBA, but I can see that the code snippet is looking at the last letter of the value in textbox 10 and multiplying it by two if the value in combobox 27 is upper case (I think). Have you tried tweaking this for your stated purposes? What did you come up with?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't work calculation?

    This??


    Please Login or Register  to view this content.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,474

    Re: Can't work calculation?

    Why would you multiply if the intention is to divide? The multiplication operator is *, but to divide, you need /. Have you actually tried your suggestion?

  5. #5
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't work calculation?

    sorry, yes its a multiplication required. testing now

  6. #6
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't work calculation?

    Tried this but it doesn't work?









    Please Login or Register  to view this content.

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Can't work calculation?

    What is this supposed to mean?
    Please Login or Register  to view this content.
    You are not actually comparing the value to anything.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  8. #8
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't work calculation?

    yes, I've scraped code together. The uppercase command is not necessary, trying to rework

  9. #9
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't work calculation?

    Essentially, I'm trying to take the first number from ComboBox10, multiply by 2 and paste the result in TextBox27

  10. #10
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Can't work calculation?

    That would simply require
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't work calculation?

    Still nothing. I'ts probably something illogical that I've done :-/

    Might be easier to show you the file?


    Press Axle generator

    select 54 SQ

    select STUD/PCD
    Select 5/165

    Result in TextBox27 - Wheel Nut
    Attached Files Attached Files

  12. #12
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Can't work calculation?

    Why have you put the code into the change event of Textbox27? (I believe we've had this conversation before)

    Also, I notice that you have used Application.Enableevents = False in at least one of your event routines. That does not affect events on userforms so serves no purpose the way you are using it.

  13. #13
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't work calculation?

    How do I know what is the the most appropriate Box to insert changes. I though that the box that is affected is where the changes are to be made?

    I'll delete the the application.EnableEvents
    Last edited by bralew; 10-31-2016 at 05:51 AM.

  14. #14
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Can't work calculation?

    The Change event for a control is triggered when that control is changed. So the Change event for Textbox27 is only fired when you change Textbox27. It is therefore not the place to put code to populate Textbox27. If Textbox27 depends only on the value of Combobox10, then you should be using an event triggered whenever Combobox10 is changed.

  15. #15
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't work calculation?

    Got it, thank you very much. I've changed to ComboBox10 and it works well :-)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Earth work calculation
    By renjithpaduvilan in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-13-2012, 08:18 AM
  2. Earth work Quantity calculation
    By renjithpaduvilan in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 11-13-2012, 01:46 AM
  3. Help required to work out calculation... Please...
    By Snowmonster in forum Excel General
    Replies: 2
    Last Post: 10-02-2012, 05:11 AM
  4. Why Doesn't My Calculation Work
    By Launchnet in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-16-2011, 03:40 AM
  5. age calculation with non-traditional work sheet
    By crunch in forum Excel General
    Replies: 1
    Last Post: 08-23-2006, 04:47 PM
  6. Manual calculation does not work
    By Hmmmm in forum Excel General
    Replies: 3
    Last Post: 02-18-2005, 10:06 AM
  7. Replies: 4
    Last Post: 01-10-2005, 03:06 PM

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