+ Reply to Thread
Results 1 to 7 of 7

Insert Blank Rows between sorted projects, Subtotal project to the right of final project.

  1. #1
    Registered User
    Join Date
    06-05-2012
    Location
    Afton, OK USA
    MS-Off Ver
    2007
    Posts
    8

    Insert Blank Rows between sorted projects, Subtotal project to the right of final project.

    Hello Excel People,

    I am new to VBA and creating Macros. What I am looking for is a macro to insert 1 blank row between each unique ungrouped project set. Also I need to subtotal each project to the right of the last entry for each project. Most project have thousands of rows and I am forced to manually insert blank rows, consuming a lot of uneccesary time. Here is a simple example of the desired effect, before and after.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Insert Blank Rows between sorted projects, Subtotal project to the right of final proj

    Try this

    Please Login or Register  to view this content.
    Regards,
    Khaled Elshaer
    www.BIMcentre.com

    Remember To Do the Following....
    1. Thank those who have helped you by clicking the Star below their post.
    2. Mark your post SOLVED if it has been answered satisfactorily:
    • Select Thread Tools (on top of your 1st post)
    • Select Mark this thread as Solved

  3. #3
    Registered User
    Join Date
    06-05-2012
    Location
    Afton, OK USA
    MS-Off Ver
    2007
    Posts
    8

    Re: Insert Blank Rows between sorted projects, Subtotal project to the right of final proj

    Kelshaer, thanks for your contribution. It worked perfectly. Seemed simple too. Any advice on where to begin with learning to write simple codes likes this? I'd like to contribute and not just leech off the forums.

  4. #4
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Insert Blank Rows between sorted projects, Subtotal project to the right of final proj

    I will send you a PM.
    Just please mark this Thread as SOLVED

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Insert Blank Rows between sorted projects, Subtotal project to the right of final proj

    @ ZAC7

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  6. #6
    Registered User
    Join Date
    06-05-2012
    Location
    Afton, OK USA
    MS-Off Ver
    2007
    Posts
    8

    Thumbs up Re: Insert Blank Rows between sorted projects, Subtotal project to the right of final proj

    Thanks for the info. Cutter. Yes I am new to the forum and I will happily abide by the forum rules. Pardon my temporary ignorance. I think the forum is great and will review the rules and guidelines carefully from now on. Besides that, any tips such as those you gave recently are much appreciated!

  7. #7
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Re:Can improve speed by following macro

    PHP Code: 
    Sub InsertBlanlRowWithToTal()
     
    Dim Rws As LongwW As LongToTal As DoublezZ As Long
     Dim Cls 
    As Range
     
     Columns
    ("H:H").Insert Shift:=xlToRight
     Rws 
    Cells(Cells.Rows.Count"B").End(xlUp).Row
     
     ReDim Arr
    (1 To 2 Rws1 To 2):               ReDim ATmp(2 To Rws 1)
     
     
    ATmp() = Range("B2:B" Rws 1).Value:
     
    Arr(11) = "Project ToTal":                   Arr(12) = "GPE.COM"
     
    Arr(Rws 12) = "A01"
     
    For wW 2 To Rws
        Arr
    (wW2) = "A" zZ
        ToTal 
    ToTal Cells(wW"F").Value
        
    If ATmp(wW 11) <> ATmp(wW1) And ATmp(wW1) <> "" Then
            zZ 
    zZ 1
            Arr
    (Rws zZ2) = "A" zZ zZ:   Arr(wW1) = ToTal
            ToTal 
    0
        End 
    If
    GPE:
     
    Next wW
     
    [h1].Resize(Rws2).Value Arr()
     [
    h1].CurrentRegion.Sort Key1:=Range("I2"), Order1:=xlAscendingHeader:=xlGuess_
        OrderCustom
    :=1MatchCase:=FalseOrientation:=xlTopToBottom
     Columns
    ("I:I").ClearContents
    End Sub 
    AddBlankRow.jpg

+ 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