+ Reply to Thread
Results 1 to 5 of 5

Development of a macros that inserts a row into sheet 1 to insert in sheet 2

  1. #1
    Registered User
    Join Date
    01-09-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    5

    Development of a macros that inserts a row into sheet 1 to insert in sheet 2

    Hi,

    I have a question revolving around an "insert a row" and "copy the formula" macros - I'm not that familiar with coding in excel but found the following script online - which works really well in the attached example:

    Sub InsertRow()
    Dim Rng, n As Long, k As Long
    Application.ScreenUpdating = False
    Rng = InputBox("Enter number of rows required.")
    If Rng = "" Then Exit Sub
    Range(ActiveCell, ActiveCell.Offset(Val(Rng) - 1, 0)).EntireRow.Insert
    'need To know how many formulas To copy down.
    'Assumesfrom A over To last entry In row.
    k = ActiveCell.Offset(-1, 0).Row
    n = Cells(k, 256).End(xlToLeft).Column
    Range(Cells(k, 1), Cells(k + Val(Rng), n)).FillDown
    End Sub

    All I need is a few tweaks - which I have no idea how to do....

    I would like it not to copy the data in column B and I would like it to insert exactly the same amount of rows and the relevant formula in the same place in Sheet "B".

    Any help would be much appreciated!

    THANK YOU
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    09-21-2012
    Location
    illinois
    MS-Off Ver
    Excel 2010
    Posts
    242

    Re: Development of a macros that inserts a row into sheet 1 to insert in sheet 2

    This should help you

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-09-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Development of a macros that inserts a row into sheet 1 to insert in sheet 2

    Hi,

    Thank you very much for the response. Unfortunately when I copy the script into Macros i get the error message in the picture attached. I assume it might be some kind of syntax issue.

    Untitled.jpg

    Thanks again

  4. #4
    Forum Contributor
    Join Date
    09-21-2012
    Location
    illinois
    MS-Off Ver
    Excel 2010
    Posts
    242

    Re: Development of a macros that inserts a row into sheet 1 to insert in sheet 2

    Ok I'm not exactly sure what you are trying to do. Are you trying to copy the whole sheet except column B? or just a portion?

  5. #5
    Registered User
    Join Date
    01-09-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Development of a macros that inserts a row into sheet 1 to insert in sheet 2

    Hi - Sorry for the confusion. Let me try and be a little clearer - Sheet A and B should be identicle. The macros I currently have working just inserts a row and copies the formula's down in Sheet "A".

    Ideally, what i'd like to create is a macros that does this + inserts the same amount of rows in exactly the same place and copies all the formula's in sheet "B"

    If I could stop the Macros copying column B in sheet "A" that would be perfect but it isn't too much of a concern...

    Does this make things a little clearer?

    Thanks for the help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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