Results 1 to 4 of 4

Thread: Response Rate keeps rounding!

  1. #1
    Guest
    Okay!!! I'm currently learning to code. My problem...

    I'm making a simple formula for the results of a Response Rate to a Subscriber Base. Now... When I use 1000 as a Subcriber Base and multiply by 2.00 as the Rate of Response, I receive '20' in my text box. The correct answer.

    But when I change the Rate of Response to 2.50, I still get 20 as an answer! Not '25'!. If I use 3.00 as a Rate of Response I receive 30! Again a correct answer. Where am I rounding my decimals???

    Here is what I'm using. (Don't laugh, I'm a new guy remember!)

    ***********************************************************
    Dim intResp As Integer
    Dim lngSubscr As Long

    intResp = txtRate.Text
    lngSubscr = txtSubscribers.Text

    'intResp is response percentage to subscribers as entered by User.
    'lngSubscr is the total number of subscribers as entered by User.

    txtAnswer.Text = (intResp * lngSubscr) / 100

    ***********************************************************

    I've read and tried different Formats without any luck for the last 2 hours. Now it's time to go meet some friends.

    I did use the "Percent" Format for a different excersise, to return a Value with a percent sign. It worked okay.

    And one last thing... How do you write your code within these forums to show the Blue, Green and Red colors???

    Thanks!

    P.S. I'll give back to others as I learn myself!

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    An integer can only hold whole numbers, and not decimals.
    Instead of:
    Dim intResp As Integer
    use this:
    Dim intResp As Double

  3. #3
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Leavenworth KS USA
    Posts
    482

    Smile

    Frans’ got it, though if you want/need to save an infinitesimal amount of memory a single will do.

    As far as colors go, I haven't a clue. But you can use use "[" and "]" with i, b, quote, code to add different emphasis. (Check my post in Reply Mode if I'm not being clear enough).

  4. #4
    Guest

    Thumbs up

    Just returned from a fantastic night out!

    Thanks to both of you for your help. I'll make the changes first thing in the morning!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width