Created
October 8, 2022 16:30
-
-
Save s-hiiragi/6b1e705a0ebb74c4bcf4d051f0d2129e to your computer and use it in GitHub Desktop.
(Excel VBA) 複数のセル範囲を結合して返すサンプル
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
' 複数のセル範囲を結合する | |
Function JoinRanges(ParamArray rs() As Variant) | |
Dim c As Long | |
Dim i As Long | |
Dim k As Long | |
Dim r As Variant | |
Dim z() As Variant | |
c = 0 | |
For Each r In rs | |
c = c + r.Count | |
Next | |
ReDim z(c - 1, 0) | |
k = 0 | |
For Each r In rs | |
For i = 1 To r.Count | |
z(k, 0) = r(i) | |
k = k + 1 | |
Next | |
Next | |
JoinRanges = z | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment