Step 1: In the same module let us start with another subprocedure. But we can also add or delete the values for the column. I want to fetch the last value in the column and display it. For this example, I have values in sheet 3 column 1. To explain the use of the Preserve statement in a dynamic array. We will discuss this example in two steps in two examples. Step 7: Run this code by hitting the F5 or Run button which is placed on the topmost ribbon of VBE. we can see the result on Sheet 1 Worksheets("Sheet1").Range("A4").Value = numbers(3) Worksheets("Sheet1").Range("A3").Value = numbers(2) Worksheets("Sheet1").Range("A2").Value = numbers(1) Worksheets("Sheet1").Range("A1").Value = numbers(0) Step 6: Now we can assign these values to the ranges in sheet 1. Step 5: Now the array has a size of three that can hold integer values. Step 4: Currently the numbers are an array which can hold integer values and is a dynamic array if we want to resize the array we can do it with the Re Dim Keyword.ĭim numbers() As Integer ReDim numbers(3) Step 3: So declare an array for the dynamic array.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |