Sub シート_データベース構造の解析_フィールドの情報()
'データベース構造の解析のフィールドの情報を編集する。 Dim s As Worksheet Dim r_end As Integer Dim i As Integer Dim i1 As Integer Dim w_int As Integer Dim w_テーブル As String Set s = ActiveSheet With s.UsedRange r_end = .Row + .Rows.Count - 1 End With
For i = 1 To r_end w_int = InStr(1, s.Cells(i, 1), "テーブル: ") If w_int > 0 Then w_テーブル = Trim(MidB(s.Cells(i, 1).Value, 11, 40)) End If If Trim(Left(s.Cells(i, 1).Value, 11)) = "" And Trim(Mid(s.Cells(i, 1).Value, 12, 1)) <> "" Then If Mid(s.Cells(i, 1).Value, 12, 6) <> "フィールド名" Then s.Cells(i, 1).Interior.ColorIndex = 6 s.Cells(i, 2).Value = w_テーブル s.Cells(i, 5).Value = Trim(Mid(s.Cells(i, 1).Value, 12, 20)) s.Cells(i, 8).Value = Trim(Mid(s.Cells(i, 1).Value, 78, 20)) s.Cells(i, 9).Value = Trim(Right(s.Cells(i, 1).Value, 10)) i1 = i End If End If w_int = InStr(1, s.Cells(i, 1), "Caption:") If w_int > 0 Then s.Cells(i1, 3).Value = Trim(Mid(s.Cells(i, 1).Value, 56, 20)) End If w_int = InStr(1, s.Cells(i, 1), "Required:") If w_int > 0 Then If Trim(Mid(s.Cells(i, 1).Value, 56, 20)) = "True" Then s.Cells(i1, 7).Value = "P" End If s.Cells(i1, 10).Value = Trim(Mid(s.Cells(i, 1).Value, 56, 20)) End If w_int = InStr(1, s.Cells(i, 1), "Description:") If w_int > 0 Then s.Cells(i1, 11).Value = Trim(Mid(s.Cells(i, 1).Value, 56, 99)) End If Next i
For i = 1 To r_end
If s.Cells(i, 1).Interior.ColorIndex = 6 Then If s.Cells(i, 3).Value = "" Then s.Cells(i, 3).Value = "'-" End If End If Next i s.Columns("B:K").ColumnWidth = 2 s.Columns("B:K").EntireColumn.AutoFit
End Sub