Thread: Sum cells
View Single Post
  #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