Sum cells
How can I sum several cells and display the result in a textbox
-- Tdp |
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 |
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 |
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 |
All times are GMT +1. The time now is 11:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com