Clear Cell on Open and Close Not Working

londonparisrome

New Member
Joined
Aug 1, 2019
Messages
25
I have an Excel hosted on my OneDrive that needs to be cleared on open and close. It has a drop-down of student names for parents to check status of their student's activities. I have entered the following code, but it is not clearing the student name.
VBA Code:
Private Sub Workbook_Open()
     Application.EnableEvents = False
     Worksheets("Status").Range("E5").Value = ""
     Application.EnableEvents = True
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
     Worksheets("Status").Range("E5").Value = ""
End Sub

Any suggestions?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I don't believe that VBA runs on files in OneDrive (at least that is what I have seen/read).
I think they may need to be on a local drive.
 
Upvote 0
I don't believe that VBA runs on files in OneDrive (at least that is what I have seen/read).
I think they may need to be on a local drive.
Bummer. Are there any solutions for a OneDrive file? I really don't want the last student's name and status left on the screen for the next parent.
 
Upvote 0
Bummer. Are there any solutions for a OneDrive file? I really don't want the last student's name and status left on the screen for the next parent.
Here are some articles you may want to check out:
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

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