回答編集履歴

2

誤字・脱字

2024/11/26 11:05

投稿

mattuwan
mattuwan

スコア2163

test CHANGED
@@ -7,13 +7,17 @@
7
7
  Sub test()
8
8
  Dim rngList As Range
9
9
  Dim r As Range
10
+ Dim strBlock As String
11
+ Dim lngCol As Long
12
+ Dim lngRow As Long
10
13
 
11
14
  Set rngList = Workbooks("???.csv").Worksheets(1).Range("A1").CurrentRegion
12
15
  For Each r In rngList.Rows
13
- With ThisWorkbook.Worksheets("座席表")
16
+ strBlock = r.Cells(1).Value
14
- .Range (r.Cells(1).Value), .Cells(r.Cells(2).Value, r.Cells(3).Value) _
15
- .Interior.Color = vbRed
17
+ lngCol = r.Cells(2).Value
16
- End With
18
+ lngRow = r.Cells(3).Value
19
+
20
+ ThisWorkbook.Worksheets("座席表").Range(strBlock).Cells(lngCol, lngRow).Interior.Color = vbRed
17
21
  Next
18
22
  End Sub
19
23
  ```

1

脱字の修正

2024/11/26 10:59

投稿

mattuwan
mattuwan

スコア2163

test CHANGED
@@ -11,7 +11,7 @@
11
11
  Set rngList = Workbooks("???.csv").Worksheets(1).Range("A1").CurrentRegion
12
12
  For Each r In rngList.Rows
13
13
  With ThisWorkbook.Worksheets("座席表")
14
- .Range(r.Cells(1).Value).Cells(r.Cells(2).Value, r.Cells(3).Value) _
14
+ .Range (r.Cells(1).Value), .Cells(r.Cells(2).Value, r.Cells(3).Value) _
15
15
  .Interior.Color = vbRed
16
16
  End With
17
17
  Next