State about ARRAY
How arrow works?
How many ways we create Arrays?
We can define array in two ways:
How to declare an ARRAY
Defining Arrary Name
Data Type = Variant
State about OPTION BASE
Create an array using Option base 0 and 1
Classification of ARRAYs
Classification of ARRAYs based on memory size
Dynamic Array
Ex: Sheets in a workbook, files in a folder... all these are unknown unless we manullay count then
Array - retrieve vlaues
Private Sub CommandButton1_Click()
Dim j(1 To 7) As Variant
For i = 1 To 7
'retrieve the values from the arrary
Cells(i, 3).Value = j(i)
Next
End Sub
Selected file Names
Private Sub CommandButton1_Click()
fileopen = Application.GetOpenFilename(MultiSelect:=True)
For i = LBound(fileopen) To UBound(fileopen)
Cells(i, 1).Value = fileopen(i)
Next
End Sub
Copy values through Range Bound
Private Sub CommandButton1_Click()
Dim sriguru(1 To 5) As String
sriguru(1) = "apple"
sriguru(2) = "banana"
sriguru(3) = "orange"
sriguru(4) = "Eraser"
sriguru(5) = "Slate"
Dim i As Integer
'For i = 1 To 5
For i = LBound(sriguru) To UBound(sriguru)
output = MsgBox("mention the result", vbYesNoCancel + vbDefaultButton2 + vbQuestion)
If output = vbYes Then
Range("A" & i).Value = sriguru(i)
End If
Next
End Sub
Hide multiplesheets using array
Count the Words
Function wordscount() As Long
wordscount = UBound(Split(Range("A1"), " ")) + 1
End Function
Copy entire array into worksheet
SH.Range("I5").Resize(UBound(SheetName, 1), 1).Value = SheetName