+ Reply to Thread
Results 1 to 6 of 6

How to convert a label to number automatically

  1. #1
    Registered User
    Join Date
    09-27-2015
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    3

    How to convert a label to number automatically

    Hello experts,

    I'm new to VBA and basically what I'm trying to do must be very simple to a lot of you.

    It's a program for ordering items. I have a userform that sends the orders to a worksheet. I'm trying to sum the items, but it seems like the cells don't recognize the label as numbers. What code should I use? And where should I use this code? I'm kind of lost on this. I did a lot of searches but didn't find anything about it. Thanks for any help

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: How to convert a label to number automatically

    Depends on what type of numbers they are, but you can look into type casting. If the labels are strings and you wanted them as Integers, you can use CInt(label).

    This would be best to handle as the userform is outputting the values to the spreadsheet. Can you provide the userform code, or at least the part where the values are being outputted?

    Also, if you can mention the number type you want the values to be (Integers, Long, Double, etc.)
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Registered User
    Join Date
    09-27-2015
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    3

    Re: How to convert a label to number automatically

    Hi, thank you so much for your reply and time to help me! I'm having a hard time on this and I'm really hoping I can get some help here.

    Basically what I want to do now is the sum of all my items in G16 and the quantity total in F16.
    Here is the code I'm using.
    And I also would like to know if there is a way to automatically clear the userform right after we hit the button "Add to Order"?


    HTML Code: 
    From what I read about type casting I think I need the Double. I'm not sure though. For SubTotal is US$ currency and quantity integer.
    Sorry, I'm really new on this! Thanks again.

    Thalyta
    Last edited by thalybp; 10-07-2015 at 05:17 PM.

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: How to convert a label to number automatically

    Still kinda hard to tell because I don't know what your variables (Reference, CAtegory, etc.) are, but try

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-27-2015
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    3

    Re: How to convert a label to number automatically

    Hi, it didn't work. It gives a Error 13. I guess the variable for Reference is integer but what I need is only the "Subtotal" to be a number or currency so I can sum them in my spreedsheet.
    Let me explain better. I have this userform with 7 variables and this is a simple program for placing order of some items. My customer will be able to choose the reference in a combobox and type the quantity desired in a textbox and the category, product, unit, price and subtotal will show automatically. When he hits ok all this information go to my spreadsheet and there I want to be able to sum the subtotal and quantity. Do you have a better idea? Thanks again!

  6. #6
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: How to convert a label to number automatically

    I really need to see the worksheet and the userform and the userform code.

+ 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. [SOLVED] vba code to convert 'n' number of dataset into tables automatically.
    By Ishwarind in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-20-2014, 04:08 AM
  2. [SOLVED] Automatically convert number to percentage
    By mijam in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-22-2013, 07:20 PM
  3. Convert Number into Word automatically, easy steps
    By kamalpranav in forum Excel General
    Replies: 0
    Last Post: 12-19-2011, 01:03 PM
  4. convert empty label caption into number
    By johncassell in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2009, 08:49 AM
  5. how to automatically convert a number to words in Excel
    By Anil-HML in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-08-2005, 11:10 PM
  6. How to convert a label to numeric
    By quickcarl83 in forum Excel General
    Replies: 3
    Last Post: 06-01-2005, 04:05 PM
  7. Convert a label to a formula
    By PeterW in forum Excel General
    Replies: 1
    Last Post: 02-20-2005, 09: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