Computer Learning Zone CLZ Access Excel Word Windows

People who think they know everything are a great annoyance to those of us who do.

-Isaac Asimov
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Visual Basic Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
RE: Visual Basic - adding numbers
Adam 

16 years ago
Hi Richard,

You answered the question below some time ago and I need a similar response, however it doesn't quite work. Once the value gets to 0.6 it then needs to go to 1 and then 1.1, 1.2 and so on. With your code the value goes from 0.6 to 1.6, 2.6, 3.6 and so on due to the Else X = X + 1.0. I'm guessing it needs an exception of some sort to keep it on a 0.1 increase but stopping at 0.6.

Thanks,
Adam

Visual Basic - adding numbers
Expert: Richard Rost - 5/29/2008

Question
Hi Richard,
I am currently making a program for my school to use for their cricket team. However I have trouble adding up the amount of Overs. How do I tell VB to count to 0.6 before adding 1?

More specifically...
When a decimal number reaches 0.6, 1 is added to the current value each time. i.e. 1.6 then +1, 2.6 then +1.

Answer
I'm assuming you're adding up by 0.1 until you get to 0.6.

In that case, you could say:


'If X < 0.6 Then
'   X = X + 0.1
'Else
'   X = X + 1.0
'End If


Easy enough?


Answer from Richard Rost:

Well, just change the code a little bit:

If X < 0.6 or X > 0.6 then
  X = X + 0.1
Else
  X = 1
End If

Basically if I understand what you're telling me, unless X is exactly 0.6 then you need to add 0.1 to it, otherwise, if it is 0.6, set it equal to 1.0.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Visual Basic Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/9/2026 2:01:04 AM. PLT: 0s