Archive old weeks in Schedule file

Revoo

New Member
Joined
Feb 8, 2017
Messages
12
Hello!

Me and my colleagues uses an excel file to show our work schedule week by week. However as the weeks go by its more and more annoying having to scroll further and further to the right to see how your current schedule is.

My question is: Is it possible to cut out all the old weeks automaticaly and paste it in another sheet as an "archive"?. Make it automatic so when you open the file on monday for example the previous week will already be moved by itself.

Thanks for reading and hope I can get some help with this! :)
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
you can simply hide all the old columns after reading them. select the columns and right click and select ' Hide' .
 
Upvote 0
you can simply hide all the old columns after reading them. select the columns and right click and select ' Hide' .
Hi, thanks for your reply. I do understand that I could just hide the columns but it wouldn't work well for us. It would make everything much eaiser if we could cut it out and paste it on another sheet instead.
 
Upvote 0
to automate this, what all columns should we work on? and can you provide the column names and column positions if possible.
 
Upvote 0
to automate this, what all columns should we work on? and can you provide the column names and column positions if possible.
Hi, I'll attach a picture of how it looks like now. One day for each column, starting from A and expanding to the right untill the end of the year
5S7kv7A.png
 
Upvote 0
run the below macro.I have kept the name as Sheet1.

Sub latest()
Dim LastCol As Integer
Sheets("Sheet1").Select
With ActiveSheet
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With
Sheets("Sheet1").Select
Sheets("Sheet1").Copy Before:=Sheets(1)
Sheets("Sheet1 (2)").Select
Sheets("Sheet1 (2)").Name = "Archive"
Sheets("Sheet1").Select
Range(Cells(, 1), Cells(, LastCol - 1)).Select
Selection.Delete Shift:=xlToLeft
End Sub
 
Last edited:
Upvote 0
run the below macro.I have kept the name as Sheet1.

Sub latest()
Dim LastCol As Integer
Sheets("Sheet1").Select
With ActiveSheet
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With
Sheets("Sheet1").Select
Sheets("Sheet1").Copy Before:=Sheets(1)
Sheets("Sheet1 (2)").Select
Sheets("Sheet1 (2)").Name = "Archive"
Sheets("Sheet1").Select
Range(Cells(, 1), Cells(, LastCol - 1)).Select
Selection.Delete Shift:=xlToLeft
End Sub
Hi! Thanks for the code, it does copy it to a new sheet, however there are some vital things missing.

1. It can only run once because it says the name is taken everytime you want to archive it
2. I would want it to also delete all the days untill the present week.

So if you click the button it copies everything from week 1 to week 7 since thats the current week and then Archive that. in the Archive sheet. Then it deletes those weeks in the Sheet1.
 
Upvote 0
I need more details to provide you the code. when your data gets updated, does the update happen on the same sheet that you have archived. Or you will get a complete new file.

give me some more details with logical flow so that I can prepare the sequential algorithm. consider an example and give me the detail operations in sequentially.
 
Upvote 0
I need more details to provide you the code. when your data gets updated, does the update happen on the same sheet that you have archived. Or you will get a complete new file.

give me some more details with logical flow so that I can prepare the sequential algorithm. consider an example and give me the detail operations in sequentially.
I'll do my best to explain everything.

2 sheets, one "main" sheet and one "Archive".

In the main sheet we update with new dates, we assign work periods (Night shift, morning shift & day shift, the "K" "M" "D" that you see in the printscreen) We can also put in vacations "Semester" (The black bars).
The Main sheet will in other words be updated and changed every now and then. So what I wish to be displayed on the main sheet is, starting from column A, the current week and future upcomming weeks.

In the archive I want all the weeks that has passed to be. So when you for example press the "Archive button" or however you want to do it, all the old weeks that has already passed in the "Main" sheet will be cut out and put in the Archive sheet. I want everything to happen in the same file. I do not want seperate files for this :) I hope this explains enough for you! Poke me if you need more to work with! I appreciate the help alot!
 
Upvote 0
Well.. This gives me some direction to look at. How should I differentiate the current week, previous week and future weeks?? do you have any column names with dates?

somehow the pictures not getting loaded in my computer. the reason why I am asking more details from you.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,715
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top