Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Autorunning Macros

I have the following Macro set up in a workbook:-

Sub datechk()
Application.ScreenUpdating = False
For a = 1 To ActiveSheet.UsedRange.SpecialCells(xlLastCell).Row
If Cells(a, 4).Value < Date Then GoTo hit
Next a
MsgBox ("Accounts appear to be in order")
Application.ScreenUpdating = True
Exit Sub
hit:
MsgBox ("You have some accounts to be deleted!")

Application.ScreenUpdating = True
End Sub


To run this Macro, I have shortcuted it as Ctrl + Q.

Is there any way I can get this Macro to run automatically on opening the
workbook?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autorunning Macros

Put this code in the module:

Private Sub Auto_Open()

Call datechk

end su

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Location: Portland, Oregon
Posts: 26
Default Autorunning Macros

Huh? I got as far as View Code then got lost.

TC-
Open the VBA editor and click on ThisWorkbook. Paste the below code in the
editor window:
Private Sub Workbook_Open()
Call datechk() ' This is where you put your code to execute when the
workbook Opens
End Sub

Nice and simple :-)
--
Toby Erkson
Oregon, USA

"Don Guillett" wrote in message
...
right click the excel icon to the left of fileview codeleft window
worksheetright window open

--
Don Guillett
SalesAid Software

"That's Confidential" wrote in message
...
I have the following Macro set up in a workbook:-

Sub datechk()
Is there any way I can get this Macro to run automatically on opening the
workbook?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Location: Portland, Oregon
Posts: 26
Default Autorunning Macros

Correction: Right click on ThisWorkbook and select View Code.

"Toby Erkson" wrote in message
Open the VBA editor and click on ThisWorkbook...





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Autorunning Macros

Toby

Don's right-click on the Excel icon and "view code" puts you in the
ThisWorkbook module.

In the left-hand dialog box(general or workbook choices), click "Workbook".
The WorkBook_Open sub/End sub code lines will appear. See right-hand dialog
box for other choices.

Gord Dibben Excel MVP

On Mon, 10 May 2004 11:23:34 -0700, "Toby Erkson"
wrote:

Huh? I got as far as View Code then got lost.

TC-
Open the VBA editor and click on ThisWorkbook. Paste the below code in the
editor window:
Private Sub Workbook_Open()
Call datechk() ' This is where you put your code to execute when the
workbook Opens
End Sub

Nice and simple :-)


Reply
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
Training: More on how to use macros in Excel: Recording Macros ToriT Excel Worksheet Functions 2 February 10th 06 07:05 PM
Macro Size Limit / open macros with macros? andycharger[_7_] Excel Programming 6 February 13th 04 02:00 PM
Macros not appearing in the Tools Macro Macros list hglamy[_2_] Excel Programming 5 October 24th 03 09:10 AM
Suppress the Disable Macros / Enable Macros Dialog Shoji Karai Excel Programming 5 September 24th 03 03:10 AM
List the Macros that can be executed from Tools-Macros Rob Bovey Excel Programming 1 July 10th 03 05:34 PM


All times are GMT +1. The time now is 05:56 AM.

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

About Us

"It's about Microsoft Excel"