回答編集履歴
2
追記2
test
CHANGED
@@ -34,6 +34,54 @@
|
|
34
34
|
|
35
35
|
Loop
|
36
36
|
|
37
|
+
```
|
38
|
+
|
39
|
+
改良版
|
40
|
+
|
41
|
+
```VBA
|
42
|
+
|
43
|
+
Dim r As Long
|
44
|
+
|
45
|
+
Dim p As Long
|
46
|
+
|
47
|
+
Dim len1 As Long
|
48
|
+
|
49
|
+
Dim len2 As Long
|
50
|
+
|
51
|
+
Dim lenmin As Long
|
52
|
+
|
53
|
+
r = 1
|
54
|
+
|
55
|
+
Do
|
56
|
+
|
57
|
+
If Cells(r, 1).Text = "" Then Exit Do
|
58
|
+
|
59
|
+
len1 = Len(Cells(r, 1).Text)
|
60
|
+
|
61
|
+
len2 = Len(Cells(r, 2).Text)
|
62
|
+
|
63
|
+
If len1 < len2 Then lenmin = len1 Else lenmin = len2
|
64
|
+
|
65
|
+
For p = 1 To lenmin
|
66
|
+
|
67
|
+
If Mid(Cells(r, 1).Text, p, 1) <> Mid(Cells(r, 2).Text, p, 1) Then
|
68
|
+
|
69
|
+
Cells(r, 2).Characters(Start:=p, Length:=1).Font.ColorIndex = 3
|
70
|
+
|
71
|
+
End If
|
72
|
+
|
73
|
+
Next
|
74
|
+
|
75
|
+
If len1 < len2 Then
|
76
|
+
|
77
|
+
Cells(r, 2).Characters(Start:=len1 + 1).Font.ColorIndex = 3
|
78
|
+
|
79
|
+
End If
|
80
|
+
|
81
|
+
r = r + 1
|
82
|
+
|
83
|
+
Loop
|
84
|
+
|
37
85
|
|
38
86
|
|
39
87
|
```
|
1
追記
test
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
ワークシート関数ではできません。
|
2
|
+
|
3
|
+
マクロを作成してください。
|
4
|
+
|
1
5
|
基本的な実装はこんな感じでしょうか。
|
2
6
|
|
3
7
|
前と後で文字数は同じである前提です。
|