+ Reply to Thread
Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    09-25-2009
    Location
    Romania
    MS-Off Ver
    Excel 2003
    Posts
    46

    Insert rows and formulas above Button

    Hello,

    I have a situation that requires a button to insert 10 formated rows and some formulas above the button when it's pressed.

    I attached an example but without any macro code as I have to admit I don't know VBA.

    I need the button to insert in the table new rows identical to existing rows 5 to 14 (formated and with formulas that are on columns F and M) every time the button is pressed.

    Basicaly the button will add to the table another 10 rows identicaly to the ones above.

    If anyone help me with this I would appreciate it.

    Thanks,
    Alex


    EDIT:

    Well... I think I got something... but it always inserts in the same position instead of before the button
    Code:
    Sub Test()
        Range("nou").Offset(0).EntireRow.Select
        Selection.Copy
        Range("nou").Offset(10).EntireRow.Select
        Range("nou").Offset(10).EntireRow.Insert
        Application.CutCopyMode = False
    End Sub
    I named the range A5:N14 as "nou" (I also modified the attached example with the above macro).

    So the problem now is this part:
    Code:
        Range("nou").Offset(10).EntireRow.Select
        Range("nou").Offset(10).EntireRow.Insert
    Whitch inserts the copied cells below the range. How can I link the insertion to the position of the button and have it insert it 10 rows above the button?


    EDIT:

    Ok I aslo figured it out: I defined a new name for the cells behind the button and changed the select and insert to the button named range.

    The last problem I have (but not a major one) is if there is any way to copy only the structure and formulas not the manualy inserted data...


    Last EDIT:

    Well solved that too
    I marked the topic as solved. Thanks everyone
    Attached Files Attached Files
    Last edited by alexandruc; 03-17-2010 at 05:02 AM.

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.2.0