Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

vba courses london - perform deletions start up

Forum home » Delegate support and help forum » Microsoft VBA Training and help » vba courses london - Perform deletions on Start up

vba courses london - Perform deletions on Start up

ResolvedVersion Standard

Julian has attended:
Excel VBA Intro Intermediate course

Perform deletions on Start up

I want to input a future date into a macro that performes a function when:
1. The workbook is opened, and
2. It recognises that the inputted date is today or has been passed

I guess it would be something like this:
The following written in the "Workbook" module

Public Sub DeleteSheetsDate ()
If Date => #25/12/2007# Then Worksheets("Sheets1") _
And Worksheets("Sheets1").Delete
End if
End Sub

Many thanks
Julian

RE: perform deletions on Start up

Hi Julian

Sorry for the delay in getting back to you but our offices have been closed over Christmas. We our now processing all of our forum posts, so we will get back to shortly with an answer for you question.

Thanks

David

RE: perform deletions on Start up

Sub auto_open()
If Now() > #12/11/2006# Then
Worksheets("Sheet1").Delete
End If
End Sub

this is the code but you must name it auto_open()

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

VBA tip:

Stop Screen Flickering When Running Code

Running VBA code may cause the screen to flicker as the monitor is the slowest part of the program and cannot keep up with the very fast changes taking place.

To switch off the screen until the program is run enter the following code line:

Application.ScreenUpdating = False

The screen comes on automatically on completion of the program.

View all VBA hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.