Solved

Excel VBA Command Button and Counter Dialog Box

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

744 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

11 Experts available now in Live!

Get 1:1 Help Now