[[SoftwareEngineering]]

*Excel VBA [#x1738929]
#contents
*ブックが保存されている絶対パスを取得する [#kf6f6c20]
 ThisWorkbook.Path

*開発リボンを表示する [#k40469b7]
Excelのオプションで「[開発]タブをリボンに表示する」をチェックする。
#ref(Excel-Option-基本設定.jpg)

*サンプル [#jd12c765]
**図のリンク貼り付け [#x1867041]
 Private Sub 図のリンク貼り付け()
     ActiveSheet.Pictures.Paste(Link:=True).Select
     Application.CutCopyMode = False
     Selection.ShapeRange.Fill.Visible = msoTrue
 End Sub
//End 図のリンク貼り付け

** 選択範囲内に連番を挿入する [#v49e2199]
 Dim TargetWorksheet As Worksheet: Set TargetWorksheet = Application.ActiveSheet
 
 Dim FirstRowIndex As Long: FirstRowIndex = Selection(1).Row
 Dim FirstColumnIndex As Long: FirstColumnIndex = Selection(1).Column
 Dim LastRowIndex As Long: LastRowIndex = Selection(Selection.Count).Row
 
 Dim Counter As Long: Counter = 1
 Dim RowIndex As Long: RowIndex = FirstRowIndex
 Do
     Dim CurrentRange As Range: Set CurrentRange = TargetWorksheet.Cells(RowIndex, FirstColumnIndex)
     
     'If ((CurrentRange.Value <> "") And (CurrentRange.MergeCells)) Then
     If (CurrentRange.Value <> "") Then
         CurrentRange.Value = Counter
         Counter = Counter + 1
     End If
     
     RowIndex = CurrentRange.Offset(1).Row
 Loop While (RowIndex <= LastRowIndex)


トップ   差分 履歴 リロード   一覧 検索 最終更新   ヘルプ   最終更新のRSS