+ Reply to Thread
Results 1 to 8 of 8

Insert a new row when week ends / week starts?

  1. #1
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Leeds, England
    MS-Off Ver
    MS Office 2007
    Posts
    134

    Insert a new row when week ends / week starts?

    Hi Guys,

    I have a sheet with some results of a previous macro. They look like this:

    08 Sep 2008 Scarborough
    09 Sep 2008 Sheffield
    09 Sep 2008 Leeds
    10 Sep 2008 Leeds
    10 Sep 2008 Sheffield
    11 Sep 2008 Leeds
    11 Sep 2008 Barnsley
    12 Sep 2008 Leeds
    15 Sep 2008 Scarborough
    15 Sep 2008 Leeds
    16 Sep 2008 Nottinghamshire
    16 Sep 2008 Leeds
    17 Sep 2008 Leeds
    18 Sep 2008 Nottinghamshire

    Now, the 8th of September is a Monday and so is 15th September.

    How can I write a macro to add a row break (or 2) when the first week ends and the second week begins i.e. to produce this:

    08 Sep 2008 Scarborough
    09 Sep 2008 Sheffield
    09 Sep 2008 Leeds
    10 Sep 2008 Leeds
    10 Sep 2008 Sheffield
    11 Sep 2008 Leeds
    11 Sep 2008 Barnsley
    12 Sep 2008 Leeds


    15 Sep 2008 Scarborough
    15 Sep 2008 Leeds
    16 Sep 2008 Nottinghamshire
    16 Sep 2008 Leeds
    17 Sep 2008 Leeds
    18 Sep 2008 Nottinghamshire

    Any help much appreciated!

    dvent

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Leeds, England
    MS-Off Ver
    MS Office 2007
    Posts
    134
    I get an error message of:

    "Compile Error:

    Wrong number of arguments or invalid property assignment"

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See example


    VBA Noob
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Leeds, England
    MS-Off Ver
    MS Office 2007
    Posts
    134
    Quote Originally Posted by VBA Noob View Post
    See example


    VBA Noob


    Thanks VBA NOOB. Thats just what I wanted!!

  6. #6
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Leeds, England
    MS-Off Ver
    MS Office 2007
    Posts
    134
    Actually, when I input more details e.g.

    01 Sep 2008 Hull
    01 Sep 2008 Calderdale
    02 Sep 2008 Hull
    03 Sep 2008 Hull
    04 Sep 2008 Huddersfield
    05 Sep 2008 Leeds
    05 Sep 2008 Huddersfield
    08 Sep 2008 Scarborough
    09 Sep 2008 Sheffield
    09 Sep 2008 Leeds
    10 Sep 2008 Leeds
    11 Sep 2008 Leeds
    11 Sep 2008 Barnsley
    12 Sep 2008 Leeds
    15 Sep 2008 Scarborough
    15 Sep 2008 Leeds
    16 Sep 2008 Nottinghamshire
    16 Sep 2008 Leeds
    17 Sep 2008 Leeds
    18 Sep 2008 Nottinghamshire
    19 Sep 2008 Leeds
    22 Sep 2008 Barnsley
    22 Sep 2008 Leicester
    25 Sep 2008 Nottinghamshire
    29 Sep 2008 Sheffield
    30 Sep 2008 Sheffield
    30 Sep 2008 Leeds



    I end up with:

    01 Sep 2008 Hull
    01 Sep 2008 Calderdale
    02 Sep 2008 Hull
    03 Sep 2008 Hull
    04 Sep 2008 Huddersfield
    05 Sep 2008 Leeds


    05 Sep 2008 Huddersfield
    08 Sep 2008 Scarborough
    09 Sep 2008 Sheffield
    09 Sep 2008 Leeds
    10 Sep 2008 Leeds
    11 Sep 2008 Leeds
    11 Sep 2008 Barnsley
    12 Sep 2008 Leeds


    15 Sep 2008 Scarborough
    15 Sep 2008 Leeds
    16 Sep 2008 Nottinghamshire
    16 Sep 2008 Leeds
    17 Sep 2008 Leeds
    18 Sep 2008 Nottinghamshire
    19 Sep 2008 Leeds


    22 Sep 2008 Barnsley
    22 Sep 2008 Leicester


    25 Sep 2008 Nottinghamshire
    29 Sep 2008 Sheffield
    30 Sep 2008 Sheffield
    30 Sep 2008 Leeds


    Not quite working as I though?!

  7. #7
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Leeds, England
    MS-Off Ver
    MS Office 2007
    Posts
    134
    I have amended my output slightly and have the following:

    Day Date Project
    Mon 01 Sep 2008 Hull
    01 Sep 2008 Calderdale
    Tue 02 Sep 2008 Hull
    Wed 03 Sep 2008 Hull
    Thu 04 Sep 2008 Huddersfield
    Fri 05 Sep 2008 Manchester
    05 Sep 2008 Huddersfield
    Mon 08 Sep 2008 Scarborough
    Tue 09 Sep 2008 Sheffield
    09 Sep 2008 Manchester
    Wed 10 Sep 2008 Leeds
    Thu 11 Sep 2008 Leeds
    11 Sep 2008 Barnsley
    Fri 12 Sep 2008 Leeds
    Mon 15 Sep 2008 Scarborough
    15 Sep 2008 Leeds
    Tue 16 Sep 2008 Nottinghamshire
    16 Sep 2008 Leeds
    Wed 17 Sep 2008 Leeds
    Thu 18 Sep 2008 Nottinghamshire
    Fri 19 Sep 2008 Leeds
    Mon 22 Sep 2008 Barnsley
    22 Sep 2008 Leeds
    Thu 25 Sep 2008 Nottinghamshire
    Mon 29 Sep 2008 Sheffield
    Tue 30 Sep 2008 Sheffield
    30 Sep 2008 Leeds


    I now want to loop down column A and whenever it finds "Mon", insert a row before it. This should solve my problem.

    Workbook attached if anyone can help!
    Attached Files Attached Files

  8. #8
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Sorry was at work

    Try

    Please Login or Register  to view this content.
    VBA Noob

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Using a macro to tell when info starts and ends.
    By G33kman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2008, 01:50 PM
  2. Results by Month and Week of Month
    By ROBERTGRAHAM01 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 03-28-2008, 09:33 AM
  3. Auto Insert Blank Row For Each Cell That Ends in....
    By ExcelQuestion in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-11-2007, 01:23 AM
  4. Statistical Anomalies
    By Gurblash in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-21-2007, 04:56 PM
  5. Insert Row after every week?
    By nbaj2k in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2006, 04:42 PM

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