以下は、開始月と終了月から生成された一意の月のセットを配列に入力する VBA 関数です。
Function get_months(matrix_height As Integer) As Variant
    Worksheets("Analysis").Activate
    Dim date_range As String
    Dim column As String
    Dim uniqueMonths As Collection
    Set uniqueMonths = New Collection
    Dim dateRange As range
    Dim months_array() As String 'array for months
    column = Chr(64 + 1) 'A
    date_range = column & "2:" & column & matrix_height
    Set dateRange = range(date_range)
    On Error Resume Next
    Dim currentRange As range
    For Each currentRange In dateRange.Cells
        If currentRange.Value <> "" Then
            Dim tempDate As Date: tempDate = CDate(currentRange.Text) 'Convert the text to a Date
            Dim parsedDateString As String: parsedDateString = Format(tempDate, "MMM-yyyy")
            uniqueMonths.Add Item:=parsedDateString, Key:=parsedDateString
        End If
    Next currentRange
    On Error GoTo 0 'Enable default error trapping
    'Loop through the collection and view the unique months and years
    Dim uniqueMonth As Variant
    Dim counter As Integer
    counter = 0
    For Each uniqueMonth In uniqueMonths
        ReDim Preserve months_array(counter)
        months_array(counter) = uniqueMonth
        Debug.Print uniqueMonth
        counter = counter + 1
    Next uniqueMonth
    get_months = months_array
End Function
この関数を操作して、月の配列に追加される各値のセル行を返すにはどうすればよいですか。
これらの 2 つの値、つまり日付 (2011 年 10 月) と行番号 (つまり 456) を格納する最良の方法は何でしょうか。
トウアレイ?次に、これら 2 つの配列を含む配列を返しますか?
誰でもこの問題の解決策を提供できますか?