PC Review


Reply
Thread Tools Rate Thread

add to a cell with a button

 
 
Donny
Guest
Posts: n/a
 
      29th Apr 2007
i'm trying to create a button that will add values to a cell when the
button is clicked. The cell that is being added to already has a
value, however. the user will input their data in a few different
places, and hit the button. the code should take the input, perform a
few operations, and then add the result to the value of the cell. my
problem is adding to a cell that already has value.

thanks,
donny

 
Reply With Quote
 
 
 
 
Norman Jones
Guest
Posts: n/a
 
      29th Apr 2007
Hi Donny,

Add a CommandButton to the shhet and try
something like:

'=============>>
Private Sub CommandButton1_Click()
Dim srcRng As Range
Dim destRng As Range

Set srcRng = Me.Range("B1, B3, B5") '<<==== CHANGE
Set destRng = Me.Range("A1") '<<==== CHANGE

With destRng
.Value = .Value + Application.Sum(srcRng)
End With
End Sub
'<<=============


---
Regards,
Norman


"Donny" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> i'm trying to create a button that will add values to a cell when the
> button is clicked. The cell that is being added to already has a
> value, however. the user will input their data in a few different
> places, and hit the button. the code should take the input, perform a
> few operations, and then add the result to the value of the cell. my
> problem is adding to a cell that already has value.
>
> thanks,
> donny
>



 
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
Excel - create button to replace cell content with cell value =?Utf-8?B?YmxhY2ttb3Q=?= Microsoft Excel Worksheet Functions 3 7th Dec 2005 05:10 PM
Control Cell Link for Option Button based on value in a cell arunjoshi Microsoft Excel Misc 1 5th May 2004 03:15 AM
Control Cell Link for Option Button based on value in a cell arunjoshi Microsoft Excel Programming 1 5th May 2004 02:19 AM
Control Cell Link for Option Button based on value in a cell arunjoshi Microsoft Excel Discussion 1 5th May 2004 12:30 AM
Control Cell Link for Option Button based on value in a cell arunjoshi Microsoft Excel Programming 0 4th May 2004 05:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:32 PM.