put an event code under thisworkbook_before close somethinglike this
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.EnableEvents = False
Worksheets("sheet1").Visible = False
Application.Enableevents = True
End Sub
just a thought pop up in mind...Can we create such formula that we write only once...in VBA...and in future we just call this formula by clikcing VBA Code of related worksheet....
Public Function monthname(x As Long) As String
'use function as personal.xls!monthname(some no.)
If x = 1 Then monthname = "jan"
If x = 2 Then monthname = "feb"
If x = 3 Then monthname = "mar"
If x = 4 Then monthname = "apr"
If x = 5 Then monthname = "may"
If x = 6 Then monthname = "jun"
If x = 7 Then monthname = "july"
If x = 8 Then monthname = "aug"
If x = 9 Then monthname = "sep"
If x = 10 Then monthname = "oct"
If x = 11 Then monthname = "nov"
If x = 12 Then monthname = "dec"
End Function
This functin I have parked in personal.xls file vb editor so that it can be used in any workbook.
now in any cell in any sheet in any workbook type
=PERSONAL.XLS!monthname(3)
note exclamation mark.
the result will be
mar
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.