質問パクったわけではないですが確かに似てますね
省略しないと以下になります
処理の内容は同じです
■うまくいく方
For Each rng In Range(Cells(3, 7), Cells(m, n))
If rng.Column <> 9 Then
If rng.Value = "-" Then
dataEx.Cells(j, i) = ThisWorkbook.Sheets(dataEx.Cells(1, i).Value).Cells(rng.Row, 3).Value
dataEx.Cells(j, i + 1) = ThisWorkbook.Sheets(dataEx.Cells(1, i).Value).Cells(2, rng.Column).Value
j = j + 1
End If
End If
-----------------------------------------------------------------
■すべてスキップされてしまう方
For Each rng In Range(Cells(3, 7), Cells(m, n))
If rng.Column = 9 Then
GoTo skipCol
If rng.Value = "-" Then
dataEx.Cells(j, i) = ThisWorkbook.Sheets(dataEx.Cells(1, i).Value).Cells(rng.Row, 3).Value
dataEx.Cells(j, i + 1) = ThisWorkbook.Sheets(dataEx.Cells(1, i).Value).Cells(2, rng.Column).Value
j = j + 1
End If
skipCol:
End If
Excel VBA 質問スレ Part80
■ このスレッドは過去ログ倉庫に格納されています
236デフォルトの名無しさん
2023/12/04(月) 16:43:57.28ID:Nbpgvbo/■ このスレッドは過去ログ倉庫に格納されています
