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! :)
 
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.
Check this link, hope it helps! Imgur: The most awesome images on the Internet

Each column is one day, then the week number stretches over 7 days in the row above.

Teach name to the left has a few rows for status and work schedule.
 
Last edited:
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I am not able to open this due to network restrictions at office. I will send you the replay same time tomorrow.
 
Upvote 0
I am not able to open this due to network restrictions at office. I will send you the replay same time tomorrow.
Okay! That sucks, hate restrictions! Poke me when you need anything :) I will be waiting. Thanks for the help!
 
Upvote 0
The restrictions are kept for our network safety concerns only. Hope someone else picks this up. I will try with someone else as it is very urgent for you.
 
Upvote 0
this is a test to see if image is displayed to get round network restrictions

0f6PXWr.png
 
Upvote 0
Sub latest()
Dim LastCol As Integer
Dim Lastcol1 As Integer
Sheets("Sheet1").Select
With ActiveSheet
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With


If Sheets(1).Name = "Sheet1" Then
Sheets("Sheet1").Select
Sheets("Sheet1").Copy Before:=Sheets(1)
Sheets("Sheet1 (2)").Select
Sheets("Sheet1 (2)").Name = "Archive"
Range(Cells(, LastCol - 6), Cells(, LastCol)).Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
Sheets("Sheet1").Select
Range(Cells(, 1), Cells(, LastCol - 7)).Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
Else
Sheets("Sheet1").Select
With ActiveSheet
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With
If LastCol > 7 Then
Range(Cells(, 1), Cells(, LastCol - 7)).Select
Selection.Cut
Sheets("Archive").Select
With ActiveSheet
Lastcol1 = .Cells(1, .Columns.Count).End(xlToLeft).Column + 1
End With
Range(Cells(, Lastcol1), Cells(, Lastcol1)).Select
Selection.Insert Shift:=xlToRight
Range("A1").Select
Sheets("Sheet1").Select
Range(Cells(, 1), Cells(, 7)).Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select

End If
End If

End Sub
 
Upvote 0
Sub latest()
Dim LastCol As Integer
Dim Lastcol1 As Integer
Sheets("Sheet1").Select
With ActiveSheet
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With


If Sheets(1).Name = "Sheet1" Then
Sheets("Sheet1").Select
Sheets("Sheet1").Copy Before:=Sheets(1)
Sheets("Sheet1 (2)").Select
Sheets("Sheet1 (2)").Name = "Archive"
Range(Cells(, LastCol - 6), Cells(, LastCol)).Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
Sheets("Sheet1").Select
Range(Cells(, 1), Cells(, LastCol - 7)).Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
Else
Sheets("Sheet1").Select
With ActiveSheet
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With
If LastCol > 7 Then
Range(Cells(, 1), Cells(, LastCol - 7)).Select
Selection.Cut
Sheets("Archive").Select
With ActiveSheet
Lastcol1 = .Cells(1, .Columns.Count).End(xlToLeft).Column + 1
End With
Range(Cells(, Lastcol1), Cells(, Lastcol1)).Select
Selection.Insert Shift:=xlToRight
Range("A1").Select
Sheets("Sheet1").Select
Range(Cells(, 1), Cells(, 7)).Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select

End If
End If

End Sub
Code only seem to copy once then no more again. Am I supposed to make a macro out of this and assign a button to it or should I use it in another way?
 
Upvote 0

Forum statistics

Threads
1,215,336
Messages
6,124,329
Members
449,155
Latest member
ravioli44

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