daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Feb 19th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Public Type Trucks
  4.     NumberOfAxles As Integer
  5.     AxleWeights(15) As Double
  6. End Type
  7.  
  8. Public Sub DataCollection()
  9.  
  10. Dim NumberOfTrucks As Integer
  11. Truck(10) As Trucks
  12. Dim i, j, k As Integer
  13.  
  14. 'Determine Number of Trucks
  15. NumberOfTrucks = Cells(6, 8)
  16.  
  17. 'Populate Truck Arrays (Trucks 1 to 5)
  18.  
  19. k = 0
  20. For i = 1 To 5
  21.     Truck(i).NumberOfAxles = Cells(9, 4 + 4 * k)
  22.     k = k + 1
  23. Next i
  24.  
  25. k = 0
  26. For i = 1 To 5
  27.     For j = 1 To Truck(i).NumberOfAxles
  28.         Truck(i).AxleWeights(j) = Cells(31 + j, 3 + 4 * k)
  29.     Next j
  30.     k = k + 1
  31. Next i
  32.  
  33. End Sub
  34.  
  35. Public Sub NewSub()
  36.  
  37. For i = 1 To Truck(10).NumberOfAxles
  38.     Cells(27 + i, 22) = Truck(10).AxleWeights(i)
  39. Next i
  40.  
  41. End Sub
  42.    
  43. Dim global_var As Integer
  44. '
  45.  
  46. Sub doA()
  47. global_var = global_var + 1
  48. Debug.Print global_var
  49.  
  50. End Sub
  51.  
  52. Sub doB()
  53. global_var = global_var + 10
  54. Debug.Print global_var
  55. End Sub
  56.  
  57. Sub main()
  58. doA
  59. doB
  60. doA
  61. End Sub
  62.    
  63. Truck(10) As Trucks
  64.    
  65. Public Type Trucks
  66.     NumberOfAxles As Integer
  67.     AxleWeights(15) As Double
  68. End Type
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top