ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I move lines one week up in a weekplan (https://www.excelbanter.com/excel-programming/389503-how-do-i-move-lines-one-week-up-weekplan.html)

patrick meijer

How do I move lines one week up in a weekplan
 
Hi there,

I have little experience in basic programming, until now I could manage, but
now I have the need for some more advanced code.

Problem
I have a worksheet with a weekly planning. In the "K-column" I inserted the
weeknumbers e.g. 200718, 200719 etc. Besides all other information I aranged
the sheet into weekly sections with some lines marked with color. These are
header lines, each week 1 header line. These lines also have weeknumbers in
the K-column.
Some planning is realised some not. Every week I have to replan, and move
lines from 1 week to the next, wich is time-consuming. I am trying to
automate this. In pseudo code I am trying to realise:

precondition: I am pointing out 1 line (e.g. in week 200719). This is the
line I want to move.
action / macro

1) Sort out and remember the weeknumber from this line (Kxxx);
2) calculate next week number (200720)
3) remember this line number so we can move it
4) Find the header line (first entry) from this week (200720)
5) Insert 1 line below this header line
6) Move or Copy+delete the line from 200719 section to 200720 section
7) Remove the line in the 200719 section
8) update the weeknumber 200719 -- 200720 on the new inserted line.

I do not care about the change of years as for each year I will start a new
sheet.
This means that lines 200752 will be moved to 200753 or so. I will hand-copy
those to
a new sheet and retag them 200801. And the game will start again.
Can anyone help me sort out the code with this one?




All times are GMT +1. The time now is 07:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com