Results 1 to 3 of 3

[Button] Insert row below, copy the formulas and make them correct.

Threaded View

  1. #1
    Registered User
    Join Date
    06-16-2021
    Location
    Netherlands
    MS-Off Ver
    2105 (build 14026.20270)
    Posts
    7

    [Button] Insert row below, copy the formulas and make them correct.

    Good day dear friends,

    I would like to ask you for assisting me in my problem.
    For the last few days I am trying to add a button that will insert a row below the button and copy/stretch the formulas on all the rows.
    When I just insert a row, the formulas on column L and M are not coppied right and I get a green arrow in the left up corner so i can correct it.
    Problem is that i want to hide the M and N columns & don't want to correct it every time i insert a row.

    I couldn't find any solution on the internet :<




    I have this formula, but seems like its not working and i just dont know why.

    Sub copyRowToBelow()
        Dim rng As Range
        Set rng = ActiveCell
    
        Do While (rng.Value <> "")
            ' Insert a row below the current one
            rng.Offset(1).Insert
    
            ' Copy the current row and paste it into the row we just inserted
            rng.EntireRow.Copy rng.Offset(1)
    
            ' Set the range declaration for 2 rows below the current one
            Set rng = rng.Offset(2)
        Loop
    End Sub

    Thank you all in advance!

    Szymon
    Attached Files Attached Files
    Last edited by FDibbins; 06-17-2021 at 12:59 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Insert rows (and copy formulas) using command button
    By roseme in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-06-2014, 01:42 PM
  2. Replies: 30
    Last Post: 11-06-2013, 12:43 PM
  3. how to make command button to insert picture
    By sspreyer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2013, 04:45 AM
  4. Command Button using VBA, to insert a row with formulas below
    By AlexKost in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-14-2013, 11:50 PM
  5. Comand button to insert new row and copy formulas only
    By ir_eddie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2012, 06:14 AM
  6. [SOLVED] I want to insert a row and copy the formula with the correct formating
    By Turtleman10 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-30-2012, 03:39 PM
  7. Insert new row and insert correct formulas
    By drnaphtali in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2010, 08:54 AM
  8. Insert rows and formulas above Button
    By alexandruc in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 03-17-2010, 02:52 AM

Tags for this Thread

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