Created
October 21, 2020 05:20
-
-
Save U-1F992/25d8984d0d938eff62b1b315c6477e68 to your computer and use it in GitHub Desktop.
ワークシートを配列に格納する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' <summary> | |
''' ワークシートを配列に格納する | |
''' インデックスは1始まり、実際のセル位置と対応 | |
''' </summary> | |
''' <param name="objWorksheet">対象のワークシート</param> | |
''' <returns>配列</returns> | |
Public Function Worksheet2Array(ByVal objWorksheet As Worksheet) As String() | |
Dim strArray() As String, objCell As Range | |
Dim Row As Long, Column As Long | |
ReDim strArray(1 To objWorksheet.UsedRange.Rows.Count, 1 To objWorksheet.UsedRange.Columns.Count) | |
For Each objCell In objWorksheet.UsedRange | |
Row = objCell.Row | |
Column = objCell.Column | |
strArray(Row, Column) = objCell.Value | |
Next objCell | |
Worksheet2Array = strArray | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment