+ Reply to Thread
Results 1 to 12 of 12

Moving section headings from below section to above section..

  1. #1
    Registered User
    Join Date
    02-21-2011
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Moving section headings from below section to above section..

    Hi everyone

    I am new here so sorry if I don't explain myself fully! I'll do my best..

    I am working on a macro that manipulates data in Excel. The data consists of payroll number (column A), Name (B), Day worked (C) and hours worked (D), however after so many people the name of the department they worked in appears in column A on a line of its own, then the next departments staff details start, again followed by the name of their department.. What I need to do is move the department name from below each section of staff to above them. The number of staff in each department and the number of departments may vary from week to week.

    Could anyone please help?

    Sorry if you need anymore information! Just ask and I will try to explain more..

    Thanks for your help inadvance

    Faye
    Last edited by Fayebaline; 02-24-2011 at 07:01 AM. Reason: Solved - thank you!

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Moving section headings from below section to above section..

    hi, Fayebaline, can you post a sample workbook with original data and result you need to obtain?

  3. #3
    Registered User
    Join Date
    02-21-2011
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Moving section headings from below section to above section..

    Hi watersev

    Thanks for your reply. I hope I have attached the document correctly!

    Faye
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Moving section headings from below section to above section..

    check attachment, run code "HeaderMover" being on Sheet "Original Data"
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-21-2011
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Moving section headings from below section to above section..

    Hi Watersev

    Sorry i haven't replied - day off yesterday!

    Thank you so much for that - it works a treat. Would love to understand the VBA though! Maybe one day i will be able to do it myself!
    Thanks again

    Faye

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Moving section headings from below section to above section..

    if you are happy with the outcome please mark the thread as solved (for details on How to see forum rules)

  7. #7
    Registered User
    Join Date
    02-21-2011
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Moving section headings from below section to above section..

    Hi Watersev,

    I was just testing it and have noticed that if the department is only 1 word rather than 2 it doesn't move it. Is there a way round this please?

    Thanks Faye

  8. #8
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Moving section headings from below section to above section..

    you mean the department name is in two cells, right?

  9. #9
    Registered User
    Join Date
    02-21-2011
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Moving section headings from below section to above section..

    Sorry maybe didn't explain myself. On the spreadsheet that i attached all of the Departments had 2 words within column A, but if there was to be a department that only had 1 word e.g. Manufacturing rather than Cylinder F, then the code doesn't pick these up

    thanks

    Faye

  10. #10
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Moving section headings from below section to above section..

    check attachament, run macro "HeaderMover"
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Moving section headings from below section to above section..

    the first code works for any number of words as long as they are in column A, see attachment
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    02-21-2011
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Moving section headings from below section to above section..

    thanks for that - is works on all headers so great!
    Faye

+ 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