回答編集履歴

1

修正

2021/05/10 13:13

投稿

jinoji
jinoji

スコア4592

test CHANGED
@@ -3,6 +3,10 @@
3
3
  ```VBA
4
4
 
5
5
  Sub A()
6
+
7
+ Dim mySheet As Worksheet
8
+
9
+ Set mySheet = Activesheet
6
10
 
7
11
  Dim wb As Workbook, ws As Worksheet, rng As Range, c As Range
8
12
 
@@ -18,7 +22,7 @@
18
22
 
19
23
  For Each c In rng
20
24
 
21
- Cells.Replace what:=c.Value, replacement:=c.Offset(, 1).Value
25
+ mySheet.Cells.Replace what:=c.Value, replacement:=c.Offset(, 1).Value
22
26
 
23
27
  Next
24
28