(Solved) – Excel Macro Iteration in a Range [duplicate]

(solved)-–-excel-macro-iteration-in-a-range-[duplicate]

Here my code:

Sub Makro2()
    Sheets("Sheet1").Select    
    For i = 1 To 230
    Sheets("Sheet1").Select
        If IsEmpty(Cells(2   i, 2)) = False Then
            Range("C3,M3:X3").Select
            Selection.Copy
            Sheets("Sheet2").Select
            Cells(2   i, 1).Select
            ActiveSheet.Paste
        End If

    Next i

    Sheets("Sheet2").Select
    End Sub

The range : Range("C3,M3:X3").Select is static. How can I dynamically code it so I can use the iteration ? I tried something like this Range("Cells(2 i, 3), Cells(2 i, 13), Cells(2 i, 14)") but it doesn’t work. I’ve seen a lot of examples with a range but nothing how I can select multiple cells.

Thanks in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *