Advertisement
veronikaaa86

07. Remove Negatives and Reverse

Sep 27th, 2022
1,103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub RemoveNegativesAndReverse()
  2.     Dim arrNum As Variant
  3.     arrNum = Split("10 -5 7 9 -33 50", " ")
  4.    
  5.     Dim numList As New ArrayList
  6.    
  7.     For Each el In arrNum
  8.         If el >= 0 Then
  9.             numList.Add (el)
  10.         End If
  11.     Next
  12.    
  13.     For i = numList.count - 1 To 0 Step -1
  14.         Debug.Print numList(i)
  15.     Next
  16. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement