Hi team,
I have a spreadsheet that calculates budgets and organises projects as Tasks and Subtasks. It already has a range of functions that involve buttons and VBA code to add data, delete rows, etc. But I'm now stumped as I've been asked to make it move multiple rows together up and down.
I have attached the spreadsheet. It is a series of Tasks with a bunch of Subtasks within each task. Each task (including subtasks) comprises anything from 14 to 30 rows, and there might be up to 50 tasks. The user should be able to select a cell inside a task, and click to move that whole task (including subtasks) up and down.
All the rows associated with a task are numbered in column B.
So I think I need it to do this:
- Go to Column B of activecell
- Check what number is there (taskno)
- Go up and find the first row that has that same taskno (taskfirstrow)
- Go down and find the last row that has that same taskno (tasklastrow)
- Select and Cut the entirerows of the range taskfirstrow to tasklastrow
- IF MOVING UP: Go up to find the the first row that has the previous task number (taskno - 1). Paste before that row.
- IF MOVING DOWN: Go down to find the the last row that has the next task number (taskno + 1). Go one more row down. Paste before that row.
Any ideas?!
Bookmarks