0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ループを使用しないセル範囲と配列の高速なやり取り

Posted at
Change_Array_Range.bas
Option Explicit

Sub smaple()
    Dim arr As Variant
    Dim r As Long
    Dim c As Long
    
    'セル範囲 → 配列
    'Point: セル範囲のvalueはVariant型の変数に格納すると自動的に2次元配列に格納される。
    arr = Range("A1").CurrentRegion.Value
    r = UBound(arr, 1)
    c = UBound(arr, 2)
    
    '配列 → セル範囲
    Range(Cells(10, 1), Cells(10 + r - 1, c)).Value = arr
    
End Sub

上記コードの実行前
image.png

上記コードの実行後
image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?