Compile error thisworkbook

AlexPi

Board Regular
Joined
Apr 4, 2011
Messages
104
I searched but could not find anything that helped...

I have a spreadsheet that is updated by more than one user so I put in the code below that will show who saved it last and when. The problem I am having is that this works fine on my computer but anyone else who clicks save gets a compile error thisworkbook...

Any ideas?

Code:
Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
 
 
 
Sheets("Overview").Range("K2").Value = Environ("username")
 
Sheets("Overview").Range("K1").Value = Date
 
 
End Sub

I'm also having trouble with another part of code that works on my computer but no one else can use it. I have a check box that locks a range of cells. Other users also get a compile error for this as well.
Thanks!
 
References are attached to the workbook, so I don't see why other users could have it checked for your workbook if you don't.
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I was looking at the wrong template! I fixed the problem for good now. Thanks for all your help!

Alex
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,919
Members
452,949
Latest member
beartooth91

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