Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel VBA Command Button and Counter Dialog Box

Posted on 2006-06-29
2
Medium Priority
?
391 Views
Last Modified: 2008-02-01
I working in Excel VBA

I have this command button and when the user clicks it,  I need  a dialog box to pop up and and show it has been click 1 time and when he clicks it again to show 2 times, etc.

Any help would be appreciated!


Private Sub CommandButton28_Click()


End Sub
0
Comment
Question by:ca1358
2 Comments
 
LVL 3

Accepted Solution

by:
gafoorgk earned 2000 total points
ID: 17013902
as u insert button in excel, it'll ask u to select a macro for click event of the button. if not, u can always right click and assign macro to click event. when u write a new macro name and click New button, it'll take u to vba window and a Module with name Module1 would be created. write following lines there

Option Explicit

Private glngClickCount As Long

Sub Button1_Click()
  glngClickCount = glngClickCount + 1
  MsgBox ("u clicked it " & glngClickCount & " time(s)")
End Sub
0
 

Author Comment

by:ca1358
ID: 17017570
Thank you!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question