PC Review


Reply
Thread Tools Rate Thread

Changin Number in cell on click of button

 
 
K
Guest
Posts: n/a
 
      22nd Jul 2009
Hi all, How can i change number in cell A1 when ever i click command
button. for example i want macro that when i click on button it
should put 1 in cell A1 and when i click on button again it should put
2 in cell A1 and like this it should go till 10. I know i can achive
this from Spin button control and Scroll Bar control in excel but i
want it with command button by macro. Please can any friend can help
 
Reply With Quote
 
 
 
 
ryguy7272
Guest
Posts: n/a
 
      22nd Jul 2009
Sub Cells_Loop()
Dim i As Range
For Each i In Range("A1") 'or whatever your range is
i.Value = i.Value + 1 'or whatever your code is
Next i
End Sub

HTH,
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"K" wrote:

> Hi all, How can i change number in cell A1 when ever i click command
> button. for example i want macro that when i click on button it
> should put 1 in cell A1 and when i click on button again it should put
> 2 in cell A1 and like this it should go till 10. I know i can achive
> this from Spin button control and Scroll Bar control in excel but i
> want it with command button by macro. Please can any friend can help
>

 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      22nd Jul 2009
Sub Macro1()
ActiveSheet.Buttons.Add(141.75, 130.5, 89.25, 39).Select
Selection.OnAction = "BumpIt"
End Sub


Sub BumpIt()
With Range("A1")
If .Value < 11 Then
.Value = .Value + 1
End If
End With
End Sub

Paste both macros in a standard module. Then run Macro1 - it will create
the button and assign it to BumpIt
--
Gary''s Student - gsnu200859


"K" wrote:

> Hi all, How can i change number in cell A1 when ever i click command
> button. for example i want macro that when i click on button it
> should put 1 in cell A1 and when i click on button again it should put
> 2 in cell A1 and like this it should go till 10. I know i can achive
> this from Spin button control and Scroll Bar control in excel but i
> want it with command button by macro. Please can any friend can help
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to have once cell equal a changin cell reference on another sh =?Utf-8?B?Tmlj?= Microsoft Excel Misc 5 19th Sep 2007 12:36 AM
cHANGIN A CELL COLOUR BASED ON A CELL VALUE mohd21uk via OfficeKB.com Microsoft Excel New Users 1 19th Apr 2006 04:45 PM
Changin Cell Formats using VBA =?Utf-8?B?TWljaGFlbA==?= Microsoft Excel Misc 1 25th Jan 2006 03:38 PM
changin amount in cell =?Utf-8?B?amlsbGluZ29yZQ==?= Microsoft Excel New Users 1 20th Apr 2005 04:51 AM
Changin number when adding rows =?Utf-8?B?WXZvbm5l?= Microsoft Excel Programming 1 17th Nov 2004 01:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:03 PM.