• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

Control of Number in textbox

Hi I have 7 txtboxs one for each days order the code below has a txtbox called txtTotalOrders.Text once i enter a number in this box it is divided equally in the boxs dependent on what day it is i.e if it is Tuesday then the number is only divided between Tuesday to Saturday. The problem is I need the resulted number from the division to be rounded up or down to the nearest whole number. Any ideas??

Thanks
Andy


Private Sub txtTotalOrders_Change()
Dim intTotal As Integer
Dim dblDaily As Double

intTotal = CInt(txtTotalOrders.Text)



Select Case Weekday(Now)

Case 1
dblDaily = intTotal / 7

For i = 0 To 6
   txtDays(i) = dblDaily
Next i


Case 2
dblDaily = (intTotal) / 6

For i = 1 To 6
   txtDays(i) = dblDaily
Next i

Case 3
dblDaily = (intTotal) / 5

For i = 2 To 6
   txtDays(i) = dblDaily
Next i

Case 4
dblDaily = (intTotal) / 4

For i = 3 To 6
   txtDays(i) = dblDaily
Next i


Case 5
dblDaily = Round(intTotal) / 3

For i = 4 To 6
   txtDays(i) = dblDaily
Next i


Case 6
dblDaily = (intTotal) / 2

For i = 5 To 6
   txtDays(i) = dblDaily
Next i

Case 7
dblDaily = (intTotal)

For i = 6 To 6
   txtDays(i) = dblDaily
Next i

End Select

End Sub
0
samandrew
Asked:
samandrew
  • 2
1 Solution
 
GrahamSkanCommented:
If you declare dblDaily as Integer, it will automatically round to the nearest integer, if that's what you mean.
0
 
samandrewAuthor Commented:
Hi Graham

Oh so easy when u know what your are doing

Thanks again

Andy
0
 
GrahamSkanCommented:
Hehe.
I though I had completely misunderstood the question :). Never mind, you're learning fast.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now