'---------------<この下から>----------------------------
'#ABC ファイルディレクトリの表示内容をExcel上で項目分割するマクロ
Private Sub Worksheet_Change(ByVal Target As Range)
'情報取得開始位置
Const LC_NO_P As Integer = 1
Const LC_NAME_P As Integer = 7
Const LC_REV_P As Integer = 17
Const LC_CREATED_P As Integer = 23
Const LC_UPDATED_P As Integer = 33
Const LC_LANG_P As Integer = 43
Const LC_SECTORS_P As Integer = 50
'情報取得桁
Const LC_NO_W As Integer = 6
Const LC_NAME_W As Integer = 10
Const LC_REV_W As Integer = 6
Const LC_CREATED_W As Integer = 10
Const LC_UPDATED_W As Integer = 10
Const LC_LANG_W As Integer = 7
Const LC_SECTORS_W As Integer = 7
'AVXの情報をEXCELへ貼り付ける位置(シートの一番左上)
Const LC_貼付行 As Double = 1
Const LC_貼付列 As Integer = 1
'終了行を求める際に、必要(EXCELの一番下の行)
Const LC_一番下 As Double = 65536
'処理対象範囲
Dim LC_開始行 As Double
Dim LC_終了行 As Double
Dim LC_設定行 As Double
'ここから処理開始 ----
'> 処理対象範囲
LC_開始行 = LC_貼付行
LC_終了行 = Cells(LC_一番下, LC_貼付列).End(xlUp).Row
'> 情報設定先のクリア
Worksheets(2).Cells= ""
'> 情報設定
For LC_設定行 = LC_開始行 To LC_終了行
LC_文字列 = Cells(LC_設定行, LC_貼付列)
Worksheets(2).Cells(LC_設定行, LC_貼付列) = Mid(LC_文字列, LC_NO_P, LC_NO_W)
Worksheets(2).Cells(LC_設定行, LC_貼付列 + 1) = Mid(LC_文字列, LC_NAME_P, LC_NAME_W)
Worksheets(2).Cells(LC_設定行, LC_貼付列 + 2) = Mid(LC_文字列, LC_REV_P, LC_REV_W)
Worksheets(2).Cells(LC_設定行, LC_貼付列 + 3) = "'" & Mid(LC_文字列, LC_CREATED_P, LC_CREATED_W)
Worksheets(2).Cells(LC_設定行, LC_貼付列 + 4) = "'" & Mid(LC_文字列, LC_UPDATED_P, LC_UPDATED_W)
Worksheets(2).Cells(LC_設定行, LC_貼付列 + 5) = Mid(LC_文字列, LC_LANG_P, LC_LANG_W)
Worksheets(2).Cells(LC_設定行, LC_貼付列 + 6) = Mid(LC_文字列, LC_SECTORS_P, LC_SECTORS_W)
Next
End Sub
'---------------<この上まで>----------------------------