If you want to save the worksheet range in a array .
Here is the code-
Example 1
Sub save_worksheet_range_in_array1()
' single dimension
' declare abc as variant
Dim abc As Variant
' store a range in array
abc = Range("a1:a6")
For j = LBound(abc) To UBound(abc)
MsgBox abc(j, 1)
Next
End Sub
Example 2
Sub save_worksheet_range_in_array2()
' two and more dimension
' declare abc as variant
Dim abc As Variant
' store a range in array
abc = Range("a1:b6")
For j = LBound(abc) To UBound(abc)
MsgBox abc(j, 1)
MsgBox abc(j, 2)
Next
End Sub
Example 3
Sub save_worksheet_range_in_array3()
' two and more dimension
' declare abc as variant
Dim abc As Variant
' store a range in array
abc = Range("a1:c6")
For j = LBound(abc) To UBound(abc)
MsgBox abc(j, 1)
MsgBox abc(j, 2)
MsgBox abc(j, 3)
Next
End Sub
Subscribe to:
Post Comments (Atom)
Import data from SQL
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
-
If you want to add a new pop up button on mouse right click menu and as soon as you click on it . It shows you multiple buttons with macro a...
-
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
No comments:
Post a Comment