Forum Discussion
John_P490
Mar 30, 2021Copper Contributor
Preventing students from viewing future assingments
I have hidden my channels (weekly assignments) and will unhide that particular channel on the lesson date. Is there a way to set a date on the channel so it unhides on the lesson date?
Rajesh_Sinha
Mar 30, 2021Steel Contributor
:: Caveat :: This solution is for Excel only.
What you are trying is only possible by using VBA macro.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim AssDate As Date
AssDate = Range("A1").Value
Dim Currdate As Date
Currdate = Date
If Currdate = CDate(AssDate) Then
ActiveWorkbook.Sheets(1).Visible = xlSheetVeryHidden
Else
ActiveWorkbook.Sheets(1).Visible = xlSheetVisible
End If
End Sub
How it works:
To invoke VB Editor to use this code, you will need to press Alt+F11.
- Then Copy & Paste this code.
- Return to the sheet & Save the WB as Macro enable *.xlsm.
- Write the date in cell A1 on which you want to un hide the assignment.
N.B.
- If and when the Current date will equals to the Assign date this code will unhide the Sheet/Sheets.
- You may hide & unhide as many sheets.
- This is editable, and you may use formula as needed to compare, Current Date ( Currdate ) with Assignment Date ( AssDate ).
If Currdate = CDate(AssDate) Then
Confirm through comments whether this works or not, and if works then you may accept this as best answer as well like .
- millerblairMar 30, 2021Iron Contributor
Rajesh_SinhaThis looks like a good solution for Excel, but there is no way to run VBA within Teams as far as I know.
- Rajesh_SinhaMar 31, 2021Steel ContributorYes U are write,,, my solution only works for EXCEL Sheets if is been shared among users!!