回答編集履歴

1

コメント追記とアドレスの取得処理変更

2021/03/15 14:14

投稿

xail2222
xail2222

スコア1508

test CHANGED
@@ -12,7 +12,15 @@
12
12
 
13
13
  Dim tC2 As Long
14
14
 
15
+ 'Dim tAddress As String
16
+
15
- Dim tAddress As String
17
+ Dim tAddress1 As String
18
+
19
+ Dim tAddress2 As String
20
+
21
+
22
+
23
+ ' rSheet1のUsedRangeとrSheet2のUsedRangeの両方を含む範囲を求める
16
24
 
17
25
  tR1 = WorksheetFunction.Min(rSheet1.UsedRange.Row, rSheet2.UsedRange.Row)
18
26
 
@@ -22,12 +30,28 @@
22
30
 
23
31
  tC2 = WorksheetFunction.Max(rSheet1.UsedRange.Column + rSheet1.UsedRange.Columns.Count - 1, rSheet2.UsedRange.Column + rSheet2.UsedRange.Columns.Count - 1)
24
32
 
25
- tAddress = rSheet1.Range(rSheet1.Cells(tR1, tC1), rSheet1.Cells(tR2, tC2)).Address
26
33
 
34
+
35
+ 'tAddress = rSheet1.Range(rSheet1.Cells(tR1, tC1), rSheet1.Cells(tR2, tC2)).Address
36
+
27
- MyEXACT = Evaluate("AND(EXACT([" & rSheet1.Parent.Name & "]" & rSheet1.Name & "!" & tAddress & ",[" & rSheet2.Parent.Name & "]" & rSheet2.Name & "!" & tAddress & "))")
37
+ 'MyEXACT = Evaluate("AND(EXACT([" & rSheet1.Parent.Name & "]" & rSheet1.Name & "!" & tAddress & ",[" & rSheet2.Parent.Name & "]" & rSheet2.Name & "!" & tAddress & "))")
38
+
39
+ ' 範囲のアドレスを取得
40
+
41
+ tAddress1 = rSheet1.Range(rSheet1.Cells(tR1, tC1), rSheet1.Cells(tR2, tC2)).Address(External:=True)
42
+
43
+ tAddress2 = rSheet2.Range(rSheet2.Cells(tR1, tC1), rSheet2.Cells(tR2, tC2)).Address(External:=True)
44
+
45
+
46
+
47
+ ' EXACT実行
48
+
49
+ MyEXACT = Evaluate("AND(EXACT(" & tAddress1 & "," & tAddress2 & "))")
28
50
 
29
51
  End Function
30
52
 
31
53
 
32
54
 
33
55
  ```
56
+
57
+ ※コメント追記とアドレスの取得処理変更