Items - Updating

To refer to an item in an array you need to use the index number.
You can change an item in an array by assigning a new value to it.
The syntax for changing an existing value is the same as assigning a value for the first time.


Fixed Array - String Data Type Array

Dim myArray(3) As String 
myArray(0) = "mon"
myArray(1) = "tue"
myArray(2) = "wed"
myArray(3) = "thu"

' changes the value at index position 2
myArray(2) = "fri"
' changes the value at index position 3
myArray(3) = "sat"

Fixed Array - Variant Data Type

Dim myArray As Variant 
myArray = Array(10, 20, 30, 40)

' changes the value at index position 2
myArray(2) = "300"
' changes the value at index position 3
myArray(3) = "400"

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext