Solved

Excel VBA Command Button and Counter Dialog Box

Posted on 2006-06-29
2
377 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
using web browser with BING 40 150
Help me. 3 78
Problem to line 23 80
add criteria to query in VB, Access 2003 2 49
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

738 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