Solved

Excel VBA Command Button and Counter Dialog Box

Posted on 2006-06-29
2
367 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 500 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

813 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now