Loop Through Array Vba

[Solved] Loop Through Array Vba | Vb - Code Explorer | yomemimo.com
Question : loop through array vba

Answered by : braxton-bell

Sub LoopForArrayStatic()
   'declare a variant array
   Dim strNames(1 To 4) As String
 
   'populate the array
   strNames(1) = "Bob"
   strNames(2) = "Peter"
   strNames(3) = "Keith"
   strNames(4) = "Sam"
 
   'declare a variant to hold the array element
   Dim item as variant
 
   'loop through the entire array
   For Each item in strNames
      'show the element in the debug window.
      Debug.Print item
   Next item
End Sub

Source : https://www.automateexcel.com/vba/loop-through-array/ | Last Update : Wed, 29 Jun 22

Answers related to loop through array vba

Code Explorer Popular Question For Vb