Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Simpel commandbutton question

Is it possible to create a commandbutton that ads 1 to a specific cell (say
A1) each time you press it?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Simpel commandbutton question

Try this:

Private Sub CommandButton1_Click()
Dim x As Long
x = Range("a1").Value
x = x + 1
Range("a1").Value = x

End Sub


"Andy T via OfficeKB.com" wrote:

Is it possible to create a commandbutton that ads 1 to a specific cell (say
A1) each time you press it?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Simpel commandbutton question

' Application.CommandBars("Forms").Visible = True
' ActiveSheet.Buttons.Add(172.5, 25.5, 52.5, 52.5).Select
' Application.Goto Reference:="Macro1"
Dim count As Integer
Range("B3") = Range("B3").Value + 1

The first 3 lines are commented because I recorded adding a button to
the spreadsheet, then going into the macro editor. B3 is the cell I'm
adding one too each button push.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Simpel commandbutton question

Thanks alot both of you, it works fine


--
Message posted via http://www.officekb.com
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CommandButton Alvin Hansen[_2_] Excel Programming 3 August 16th 04 06:35 PM
Simple Question: Hiding a CommandButton JasperBlaas Excel Programming 3 August 9th 04 01:28 PM
CommandButton chris[_12_] Excel Programming 1 April 15th 04 01:01 AM
CommandButton rwebster3 Excel Programming 0 April 14th 04 08:16 PM
Commandbutton David Fixemer Excel Programming 2 February 25th 04 10:18 PM


All times are GMT +1. The time now is 02:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"