+ Reply to Thread
Results 1 to 6 of 6

Macro: insert a row

  1. #1
    Registered User
    Join Date
    11-04-2011
    Location
    Holland
    MS-Off Ver
    Excel 2003
    Posts
    2

    Macro: insert a row

    Hi all,

    I've attached an example of my monthly costsoverview.

    For each costscategory there's a commandbutton.
    I like to create a macro that insert a row between the last product and the row with total.
    For costscategory 100 should that between row 9 and 10.

    It's easy to create a macro for just one costscategory:

    Private Sub CommandButton1_Click()
    Range("B50").End(xlUp).Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

    End Sub


    But in this example there are 4 categories and 4 commandbutton...

    Is this possible?

    Thanks in advance.
    Attached Files Attached Files
    Last edited by Neocon; 11-04-2011 at 07:30 AM.

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro: insert a row

    Please use code tags (see the forum rules).



  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro: insert a row

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    11-04-2011
    Location
    Holland
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Macro: insert a row

    Well forget my old macro code.... because this one wouldn't work...

    then it's just an open question :-)

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro: insert a row

    You need to put your code (in your first post) in code tags.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro: insert a row

    neocon, if you want to use the Forum please read the rules that you agreed to!

+ 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