+ Reply to Thread
Results 1 to 12 of 12

Need VBA code to count number of rows & split into group of 7 rows in same sheet

  1. #1
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Need VBA code to count number of rows & split into group of 7 rows in same sheet

    Dear All,

    i have excel which contain data in several rows , I want Marco to be split the rows in groups , 7 possible rows in each group . in same sheet


    Example:-

    Data

    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA

    Result should be

    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA

    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA
    AA AA AA AA AA AA AA


    Thank's
    A

  2. #2
    Registered User
    Join Date
    04-30-2013
    Location
    Brussels
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Need VBA code to count number of rows & split into group of 7 rows in same sheet

    Hello amy_d2,

    You can use this very easy code :

    Please Login or Register  to view this content.
    It will do the trick.

    Have fun!
    ExcelTab.com

  3. #3
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Need VBA code to count number of rows & split into group of 7 rows in same sheet

    as an option
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: Need VBA code to count number of rows & split into group of 7 rows in same sheet

    Hi ,

    Thanks for the help , however its giving me error "Subscript out of range".

    Thanks,
    A

  5. #5
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: Need VBA code to count number of rows & split into group of 7 rows in same sheet

    Ohh.. option sent by nelim worked for me perfectly


    thank you so much both of you ......

  6. #6
    Registered User
    Join Date
    04-30-2013
    Location
    Brussels
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Need VBA code to count number of rows & split into group of 7 rows in same sheet

    Hello amy_d2

    Yes, you need to replace the "YOURSHEET" part with the actual name of your sheet.
    Or you an also write
    Please Login or Register  to view this content.
    But in any case, the code of nilem is faster and neater.

    Have fun!

  7. #7
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: Need VBA code to count number of rows & split into group of 7 rows in same sheet

    Hi

    Have tried that as well, unfortunately it didn't worked for me, i am new to VBA may be because of that, i could not handled it properly.

    Thanks for helping me....

  8. #8
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: Need VBA code to count number of rows & split into group of 7 rows in same sheet

    Dear Nliem ,

    option that you have provided to me is awesome, however while working on file i understand that it only take 252 rows in consideration , till 252 rows it works perfectly fine, but if i have more than 252 rows it gives me error "method 'range of object' Global failed

    can you pls help ??

    Thanks,
    A

  9. #9
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Need VBA code to count number of rows & split into group of 7 rows in same sheet

    try
    Please Login or Register  to view this content.

  10. #10
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Need VBA code to count number of rows & split into group of 7 rows in same sheet

    Perhaps something like this.

    The intial deleting part can be omitted.

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  11. #11
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: Need VBA code to count number of rows & split into group of 7 rows in same sheet

    No words !!!!! it worked for me fantastically ........


    thank you so much for your help

  12. #12
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: Need VBA code to count number of rows & split into group of 7 rows in same sheet

    hi mikerickson,

    i apply your code & keep for my knowledge.

    Thanks,
    A

+ 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