Hi,

I have a spreadsheet with data that I need to sort into a more 'usable' format, I want to repeat (/apply) this macro for all the data but am not sure on how to make it loop every 2 cells.

Sub Macro1()
'
' Macro1 Macro
'

'
    Range("C2").Select
    ActiveCell.FormulaR1C1 = "=CONCATENATE(R[1]C[-1],R[1]C,R[1]C[1],R[1]C[2])"
    Range("C2").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Range("B3:E3").Select
    Selection.ClearContents
    Range("C2").Select
    Selection.Cut
    Range("B3").Select
    ActiveSheet.Paste
End Sub

Recommended Answers

All 2 Replies

To walk through cells in excel sheet with macro use something like

Dim i As Integer

For i = 1 To 20 step 2
    Cells(i, 1).Value = 42
Next i

Posting macro recording code won't help much you know. :o)

Ok I will have a look at that.

Oh really, why not? :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.