Copy a row (row3) and then paste into all blank rows or all uneven number rows

Helly 1 Reputation point
2022-11-29T16:28:58.14+00:00

Hi everyone,

I have a macro which inserts blanks rows in between each row of data. I then would like to copy the formula in row 3 and paste it into the newly created rows. These are blank rows and are all uneven in number

For example:
265331-book7.png
Row 3 has cells with a formula to copy the above cell ( =OFFSET(D3,-1,-1) =OFFSET(D3,-1,-1) etc. etc.) and i would like a macro to select all of row 3 and paste special these formula's into the new blank rows / uneven rows

Hope that made sense :)

Helen

{count} votes

1 answer

Sort by: Most helpful
  1. Oskar Shon 866 Reputation points MVP
    2022-12-01T21:03:27.193+00:00

    Create loop and use if condition to check is cell is empty
    or
    Check if row /2 = \2

    Dim c As Range  
    For Each c In Selection  
          If c.Row / 2 <> c.Row \ 2 Then Debug.Print "uneven cell =" & c.Address  
          If Len(c.Value) = 0 Then Debug.Print "empty cell =" & c.Address  
    Next  
    

    Test that code after select your range
    Turn on immediate window [Ctrl+g] in VBEditor

    Regards

    0 comments No comments