1

I have an excel with two columns. Column A contains numbers and column B contains text data. Numbers are continuous like 1 2 3 with several blank cells between them as shown below. For example:

1   Text
    Text
    Text
2   Text
    Text
    Text
3   Text
    Text

I need to insert a blank row just above each of the numbers in column A.

Can anyone help me to set up an excel macro to insert a blank row just above the cell containing a number in column A.

  • SRJ, to confirm, do you want to insert a row there or just a cell and shift column A down? – Petr Fedorov Nov 14 '14 at 17:50
1

To my mind, there is a little ambiguity in your description but this is what I've come up with to exactly conform to the requirements specified.

Dim r As Long
For r = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
    If IsNumeric(Cells(r, 1).Value) And CBool(Len(Cells(r, 1).Value)) Then _
        Rows(r).EntireRow.Insert shift:=xlDown
Next r

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.