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 menu on mouse right click "Workbook Navigation showing you the list of all open workbooks and worksheets in ea...
-
Macro to Export Range in Json Format Option Explicit Sub export_in_json_format() Dim fs As Object Dim jsonfile Dim rangetoex...
No comments:
Post a Comment