|
▼Statis さん:
ありがとうございました。
ちなみに今こんな感じで異なるbookのsheet1同士を比較しています。
質問はWS1は固定値で、対するWS2の値が全角・半角、大文字・小文字
でも値や文字列が同一ならば「同一、成功」にする条件ってつけられますか?
Sub 判定()
Dim WB1 As Workbook, WB2 As Workbook
Dim WS1 As Worksheet, WS2 As Worksheet
Set WB1 = Workbooks("test-2date.xls")
Set WB2 = Workbooks("test-2DB.xls")
Set WS1 = WB1.Worksheets("sheet1")
Set WS2 = WB2.Worksheets("sheet1")
X = 8
Do While Cells(X, 5) <> ""
If WS1.Cells(X, 5) = WS2.Cells(2, 53) Then
WS2.Cells(X, 58).Value = "同一"
Else: WS2.Cells(X, 58).Value = ""
End If
If WS1.Cells(X, 7).Value >= WS2.Cells(2, 55) And WS1.Cells(X, 7).Value <= WS2.Cells(2, 56) Then
WS2.Cells(X, 59).Value = "big"
WS2.Cells(X, 60).Value = "mid"
WS2.Cells(X, 61).Value = "reg"
End If
If WS1.Cells(X, 13).Value = WS2.Cells(X, 59).Value Or _
WS1.Cells(X, 13).Value = WS2.Cells(X, 60).Value Or _
WS1.Cells(X, 13).Value = WS2.Cells(X, 61).Value Then
WS2.Cells(X, 62).Value = "成功"
Else
WS2.Cells(X, 62).Value = "失敗"
End If
If WS2.Cells(X, 58).Value = "同一" And WS2.Cells(X, 62).Value = "成功" Then
WS1.Cells(X, 14).Value = "★"
Else
WS1.Cells(X, 14).Value = "☆"
End If
X = X + 1
Loop
WS2.Columns(58).Value = ""
WS2.Columns(59).Value = ""
WS2.Columns(60).Value = ""
WS2.Columns(61).Value = ""
WS2.Columns(62).Value = ""
WS2.Columns(63).Value = ""
WS2.Columns(64).Value = ""
WS2.Columns(65).Value = ""
End Sub
よろしくお願いします。
|
|