PDA

View Full Version : Need Some Change In Count Macro Running Code



usman5594
07-25-2013, 09:30 PM
Hi ,
i Have No Knowledge About Vba , I Find This Code On an other Site
Its Work Good I Need Like This Code On My Work Book
But
I Need Some Change In This Code
Kindly Give It To Right way

No 1: I Need Workbook auto Save When Click On Message Box
No 2: In Message Box Show Remaining Time
Code Is Below


Private Sub Workbook_Open()

Dim counter As Integer

counter = Sheets("Sheet1").Range("A1").Value

If counter < 20 Then
MsgBox "When click on ok then workbook auto save to keep Cell A1 Value Save"
Sheets("sheet1").Range("A1").Value = counter + 1
Else
MsgBox "Expire " & _
"Connect Me"
ThisWorkbook.Saved = True
Application.Quit

End If

End Sub


Thank You
i Ask This Q on Other Form
http://www.excelforum.com/excel-programming-vba-macros/942316-need-some-change-in-count-macro-running-code.html

usman5594
07-26-2013, 01:43 AM
Kindly help

Aussiebear
07-26-2013, 04:33 PM
I think you are missing the point here about cross posting. Putting the same question on different forums within hours of each other shows a lack of respect to the members of each community.

SamT
07-26-2013, 04:37 PM
Are you trying to give the user only 20 times to use the workbook?



Private Sub Workbook_Open()

Dim counter As Integer

counter = Sheets("Sheet1").Range("A1").Value

If counter = 20 Then Application.Quit

MsgBox "You have " & 20 - counter & " Times Left"
Sheets("sheet1").Range("A1").Value = counter + 1
Me.Save

End Sub