LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Please check my code?

Hello,
I think I am nearing completion of a little VBA project I have been
working on to 1st: Force macros to run, by hiding all sheets except a
sheet called "Welcome", and 2nd: check the date entered on another to
be hidden sheet called "Data" against the 'Now' date. If incorrect,
then workbook closes after vbOk dialogue.

I am still learning, and at the moment I am having a mental meltdown
over why my code isn't doing a few things that I thought it would
have. Please examine:

Sub workbook_before_close()
Dim ws As Worksheet
ActiveSheet.Select
For Each ws In Worksheets
ws.Visible = xlVeryHidden
Next ws
Call Show_Welcome
End Sub

Sub workbook_open()
Dim ws As Worksheet
For Each ws In Worksheets
ws.Visible = True
Next ws
Call Hide_Datasheet
Call Hide_Welcome
If Now = Worksheets("Data").Range("A1") Then
Confirm = MsgBox("This workbook has expired. Please contact
Suppport for further assistance.", vbInformation + vbOKOnly, "Workbook
Expiry")
If Confirm = vbOKOnly Then
Application.Quit
Else: Application.Quit
End If
End If
End Sub

Sub Hide_Datasheet()
Worksheets("Data").Visible = xlVeryHidden
End Sub

Sub Show_Welcome()
Worksheets("Welcome").Visible = xlSheetVisible
End Sub

Sub Hide_Welcome()
Worksheets("Welcome").Visible = xlVeryHidden
End Sub

I know by looking at it it probably isn't the most efficient looking
code. May I kindly request someone fro this talented arena looking
over the above code, and entering comments where you think it could be
better (or fixed?) If you could avoid it, please don't enter too much
new code as that would just confuse me (Unless you belive it is really
required!)
Thank you for your help, it is greatly appreciated.

p.s. all subs are under the ThisWorkbook section
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please check my code!!!! Tdp Excel Discussion (Misc queries) 1 October 27th 08 02:39 PM
Please help (need a code check) Aaron Cooper Excel Programming 5 April 9th 04 05:56 PM
Code for Many check boxes Bob Excel Programming 0 January 23rd 04 02:16 AM
Check Box Code Bob Excel Programming 3 January 14th 04 06:07 AM
Check my code to use template? Ed[_9_] Excel Programming 1 July 23rd 03 03:04 AM


All times are GMT +1. The time now is 04:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"