B10A.FIの修正

データベースからダウンロードしたFIデータを以下のように修正する。

F03D 7/04 Z ⇒ F03D7/04,Z

このケースでは処理対象の公報データは8列目にFIデータが書き込まれている。

マクロは次のとおり。

'変数を宣言

Dim SHEETNAME01 As String

Dim NY1 As Long, NX1 As Long

Dim nclm2 As Integer

'シート名称設定

SHEETNAME01 = "重複なしデータ"

'

'処理対象のカラム数を指定

nclm2 = 8 'FI欄

'================

'FIデータの形式を修正する

'================

'FI欄ヘッダを修正

Sheets(SHEETNAME01).Select

Cells(1, nclm2) = "FI"

'区切り符号「,」を挿入

Sheets(SHEETNAME01).Select

Columns(nclm2).Select

Selection.Replace what:=" ", Replacement:=","

Selection.Replace what:=" ", Replacement:=","

Selection.Replace what:=" ", Replacement:=","

Selection.Replace what:=",,", Replacement:=","

'スペース部分を除去

Sheets(SHEETNAME01).Select

Columns(nclm2).Select

Selection.Replace what:=" ", Replacement:=""

Selection.Replace what:=" ", Replacement:=""

'G06F3/0481,120タイプを修正

For y = 2 To NY1

cellword = Cells(y, nclm2)

If InStr(cellword, ",") = 0 Then

nwd = Len(cellword)

pos = InStr(cellword, "/")

If nwd - pos = 7 Then

Cells(y, 1) = Left(cellword, nwd - 3) & "," & Right(cellword, 3)

End If

End If

Next y