#1   Report Post  
Posted to microsoft.public.excel.misc
Tdp Tdp is offline
external usenet poster
 
Posts: 74
Default Sum cells

How can I sum several cells and display the result in a textbox
--
Tdp
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Sum cells

Hi,

Put your textbox from the Control toolbox on your worksheet, you then have
choices.

1. While still in design mose right click the textbox and view code and
paste this in

Private Sub TextBox1_GotFocus()
TextBox1.Text = WorksheetFunction.Sum(Range("A1:a10"))
End Sub

Exit design mode and when the textbox is selected the sum is displayed.

or.

2. Exit desing mode and right click the sheet tab, view code and paste this in

Private Sub Worksheet_Change(ByVal Target As Range)
TextBox1.Text = WorksheetFunction.Sum(Range("A1:a10"))
End Sub

The text box now does the sum whenever the worksheet changes.

Mike

"Tdp" wrote:

How can I sum several cells and display the result in a textbox
--
Tdp

  #3   Report Post  
Posted to microsoft.public.excel.misc
Tdp Tdp is offline
external usenet poster
 
Posts: 74
Default Sum cells

Thanks Mike,
Iv used your second example.
--
Tdp


"Mike H" wrote:

Hi,

Put your textbox from the Control toolbox on your worksheet, you then have
choices.

1. While still in design mose right click the textbox and view code and
paste this in

Private Sub TextBox1_GotFocus()
TextBox1.Text = WorksheetFunction.Sum(Range("A1:a10"))
End Sub

Exit design mode and when the textbox is selected the sum is displayed.

or.

2. Exit desing mode and right click the sheet tab, view code and paste this in

Private Sub Worksheet_Change(ByVal Target As Range)
TextBox1.Text = WorksheetFunction.Sum(Range("A1:a10"))
End Sub

The text box now does the sum whenever the worksheet changes.

Mike

"Tdp" wrote:

How can I sum several cells and display the result in a textbox
--
Tdp

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Sum cells

Link the textbox to a cell in which you have a SUM formula?


Gord Dibben MS Excel MVP

On Sat, 13 Dec 2008 06:21:01 -0800, Tdp
wrote:

How can I sum several cells and display the result in a textbox


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
Excel: match two cells in one sheet to two cells in another and return a third cells value Spence Excel Worksheet Functions 3 February 13th 11 05:33 AM
Cells won't change font color or show hi-lighted cells in document ROBIN Excel Discussion (Misc queries) 1 March 27th 08 09:39 PM
display a range of cells editible cells based on matching date Miki Excel Worksheet Functions 0 October 10th 07 03:27 PM
Setting of input cells as blue font and formula cells as black fon Sunnyskies Excel Discussion (Misc queries) 2 May 14th 07 05:27 PM
trying to create an (almost) circular formula between cells and data validated cells with lists KR Excel Worksheet Functions 0 May 12th 05 07:21 PM


All times are GMT +1. The time now is 04:29 AM.

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

About Us

"It's about Microsoft Excel"