vba courses london - perform deletions start up
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

resolvedResolved · Low Priority · Version Standard

replyReply Thu 14 Dec 2006, 12:54Delegate Julian said...

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

For upcoming training course dates see: Pricing & availability

replyReply Tue 2 Jan 2007, 12:45Trainer David said...

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

replyReply Tue 2 Jan 2007, 16:48Trainer Garry said...

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()

 

Vba tip:

Count the Rows and Columns in a Selection

If you need to count the number of rows or columns in a worksheet use the following code:

Selection.Rows.Count - Returns the number of rows in the selection

Selection.Columns.Count - Returns the number of columns in the selection

Selection.CurrentRegion.Rows.Count - Returns the number of rows in the current region of the selection

View all VBA hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard