+ Reply to Thread
Results 1 to 12 of 12

Macro - Create / Copy / Paste Formula every 5 rows for varying range

Hybrid View

  1. #1
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,770

    Re: Macro - Create / Copy / Paste Formula every 5 rows for varying range

    I don't know if you want to delete the empty rows but if you do you could add this to the code.
    Make sure you try it on a copy of your workbook in case it is not what you want.

    Range("L1:L" & lr).SpecialCells(4).EntireRow.Delete
    Put this line between "Next i" and "End Sub"

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,770

    Re: Macro - Create / Copy / Paste Formula every 5 rows for varying range

    My bad. I misread your requirements.
    Try this instead. Again, on a copy of your workbook.
    If you don't want the empties deleted, delete the line before "End Sub".

    Sub Try()
        Dim lr As Long, i As Long
        lr = Cells(Rows.Count, 3).End(xlUp).Row
        For i = 3 To lr Step 5
            With Range("K" & i).Resize(, 2)
                .Formula = "=R[3]C[-10]"
                .Value = .Value
            End With
        Next i
        Range("L1:L" & lr + 3).SpecialCells(4).EntireRow.Delete
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro required for copy a range, create a new txt file and paste it
    By gm2612 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-28-2013, 07:25 AM
  2. Create a Macro to perform a custom sort on varying number of rows
    By Shirley Munro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2013, 07:09 PM
  3. Copy and paste list with varying length to specific columns/rows
    By bruizer31 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2013, 08:32 PM
  4. create macro to copy paste many rows at once
    By asaya in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2008, 03:47 PM
  5. Replies: 4
    Last Post: 04-08-2006, 08:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1