回答編集履歴

1

誤字の修正

2019/09/18 23:22

投稿

mattuwan
mattuwan

スコア2163

test CHANGED
@@ -11,6 +11,10 @@
11
11
 
12
12
 
13
13
  ```ExcelVBA
14
+
15
+ Option Explicit
16
+
17
+
14
18
 
15
19
  Sub test()
16
20
 
@@ -28,11 +32,11 @@
28
32
 
29
33
  Set rngKey = ActiveCell
30
34
 
31
- sKey = rnkey.Value
35
+ sKey = rngKey.Value
32
36
 
33
- With ActiveSheet.UsedRange
37
+ With ActiveSheet
34
38
 
35
- Set rngFind = Range(rngKey, Cells(Rows.Count, "LHL").End(xlUp))
39
+ Set rngFind = .Range(rngKey, .Cells(.Rows.Count, "LHL").End(xlUp))
36
40
 
37
41
  End With
38
42
 
@@ -44,7 +48,7 @@
44
48
 
45
49
  On Error Resume Next
46
50
 
47
- ix = WorksheetFunction.Match(s, rngFind.Cells, 0)
51
+ ix = WorksheetFunction.Match(sKey, rngFind.Cells, 0)
48
52
 
49
53
  On Error GoTo 0
50
54
 
@@ -67,6 +71,8 @@
67
71
  Next
68
72
 
69
73
  End Sub
74
+
75
+
70
76
 
71
77
  ```
72
78