Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autorunning Macros
Put this code in the module:
Private Sub Auto_Open() Call datechk end su -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autorunning Macros
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() 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? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Training: More on how to use macros in Excel: Recording Macros | Excel Worksheet Functions | |||
Macro Size Limit / open macros with macros? | Excel Programming | |||
Macros not appearing in the Tools Macro Macros list | Excel Programming | |||
Suppress the Disable Macros / Enable Macros Dialog | Excel Programming | |||
List the Macros that can be executed from Tools-Macros | Excel Programming |