0

以下のコードを使用して、列 C の空白以外のセルを行 6 から下に選択します。選択されたセルごとに、コードでその行の列 1 から 10 のセルも選択するようになりましたが、苦労しています! どんな助けでも素晴らしいでしょう!

Sub EnquiryPrep()
Dim x As Integer
Dim rng As Range
With Sheets("Sheet 1")
LR = .Range("C" & Rows.Count).End(xlUp).Row
For Each cell In .Range("C6:C" & LR)
    If cell.Value <> "" Then
        If rng Is Nothing Then
            Set rng = (cell)
        Else
            Set rng = Union(rng, cell)
        End If
    End If
    Next cell
rng.Select
End With
End Sub
4

1 に答える 1

0

おそらく単純に

Sub EnquiryPrep()
Dim x As Integer
Dim rng As Range
With Sheets("Sheet 1")
LR = .Range("C" & Rows.Count).End(xlUp).Row
For Each cell In .Range("C6:C" & LR)
    If cell.Value <> "" Then
        If rng Is Nothing Then
            Set rng = cell.offset(, -2).resize(, 10)
        Else
            Set rng = Union(rng, cell.offset(, -2).resize(, 10))
        End If
    End If
    Next cell
rng.Select
End With
End Sub
于 2013-08-15T10:25:17.477 に答える