0
1

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.

エクセルVBA 図形(Shape)を操作する。

Last updated at Posted at 2021-06-21

図形の種類

 ・VBA上で分類されるエクセルの図形の種類は、ざっと以下の通り。
 ・詳細はリンク参照。

 ・図形, ActiveX部品, フォーム部品, グラフなど
  およそ図形っぽいものすべて。

参照

  Worksheets(1).Shapes
  Worksheets(1).Shapes(1)
  Worksheets(1).Shapes("図形1")  

 ・各図形の参照は、番号か

すべて参照

  Dim s As shape
  For Each s In .Shapes

複製

  With sp.Duplicate
    .Name = sp.Name & "図形名"
    .Top = sp.Top
    .Left = sp.Left + sp.Width
  End With

コピー & ペースト

  s.Select
  s.Copy
  sheet.Paste or( Range(XX).Paste)

座標, サイズ変更

  ' x, y (絶対座標)
  Selection.ShapeRange.Top = 300
  Selection.ShapeRange.Left = 300

  ' width, height
  Selection.ShapeRange.Width = 300
  Selection.ShapeRange.Height = 300

  ' x, y (相対座標)       
  Selection.ShapeRange.IncrementLeft = 100
  Selection.ShapeRange.IncrementTop = 300

参考リンク

・基礎的な使い方

・図形の操作

・図形の種類

0
1
1

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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?