![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 38
|
I want my excel template after every 250 processes to notify me a message (eg. Save To CD writer) does anyone know how to do this?
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
What constitutes a "process"?
|
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Posts: 38
|
A process for example I data on a built-in data form and it copies that sends it to my invoice, well after every say 100 times it does this I would like it to notify me that it has done 250 process with a message box
|
|
|
|
|
|
#4 |
|
New Member
Join Date: Feb 2002
Posts: 38
|
*100 sorry
|
|
|
|
|
|
#5 | |
|
Board Regular
Join Date: Feb 2002
Location: Chippenham, UK
Posts: 136
|
Quote:
If so add a variable, initialise it to zero and add 1 every time the macro is run. Then use: If myVariable = 250 Then MsgBox("Your Message") myVariable = 0 End If Would the messagebox only be required after 250 times no matter where the process was by the time that the workbook was closed or would you like to also show the message on closing the workbook? Would the counting need to start from 1 when the workbook was opened or would it need to continue on from when the workbook was last saved?
__________________
Regards, Gary Hewitt-Long |
|
|
|
|
|
|
#6 |
|
New Member
Join Date: Feb 2002
Posts: 38
|
sorry stupid question I know nothing about VBA but how do you add a variable?
|
|
|
|
|
|
#7 |
|
New Member
Join Date: Feb 2002
Location: Bristol, England
Posts: 39
|
right at the beginning, before the fist sub write
dim processcount string then at end of variable write if processcount = 250 then save bit goes in here processcount =250 else processcount - processcount + 1 hope this is what you want. Henry |
|
|
|
|
|
#8 |
|
New Member
Join Date: Feb 2002
Location: Bristol, England
Posts: 39
|
sorry
dim processcount as string |
|
|
|
|
|
#9 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Central Florida, USA
Posts: 7,541
|
Right click a sheet tab lable, then select "View Code" from the list on your left dubble click "ThisWorkBook" and paste a copy of this code on to the sheet on your right. Hope this helps. JSW
Private Sub Workbook_SheetCalculate(ByVal Sh As Object) Dim myTest As Integer Static x As Integer 'By: Joe Was, 2/2002 x = x + 1 myTest = x If myTest >= 250 Then MsgBox "Time to Save" x = 0 Else GoTo myEnd End If myEnd: End Sub Thanks for the edit Gary, forgot the reset, was about to re-submit an updated copy and saw your post, thanks. JSW [ This Message was edited by: Joe Was on 2002-03-01 13:37 ] [ This Message was edited by: Joe Was on 2002-03-01 13:39 ] |
|
|
|
|
|
#10 | |
|
Board Regular
Join Date: Feb 2002
Location: Chippenham, UK
Posts: 136
|
Quote:
Private Sub Workbook_SheetCalculate(ByVal Sh As Object) Dim myTest As Integer Static x As Integer 'By: Joe Was, 2/2002 x = x + 1 myTest = x If myTest >= 250 Then MsgBox "Time to Save" x = 0 Else GoTo myEnd End If myEnd: End Sub
__________________
Regards, Gary Hewitt-Long |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|