Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default add to a cell with a button

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default add to a cell with a button

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" wrote in message
ps.com...
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
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
Can I add button to cell to easily view all data in cell? Geekwanabe Excel Discussion (Misc queries) 1 February 26th 09 05:39 PM
Cell working as a button? Cell color control Emerogork via OfficeKB.com Excel Worksheet Functions 1 August 30th 07 05:20 PM
Excel - create button to replace cell content with cell value blackmot Excel Worksheet Functions 3 December 7th 05 05:10 PM
Control Cell Link for Option Button based on value in a cell arunjoshi[_14_] Excel Programming 1 May 5th 04 02:19 AM
Control Cell Link for Option Button based on value in a cell arunjoshi[_13_] Excel Programming 0 May 4th 04 05:46 AM


All times are GMT +1. The time now is 02:29 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"