ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UserForm with Cell Data (https://www.excelbanter.com/excel-programming/278919-userform-cell-data.html)

Phil Hageman

UserForm with Cell Data
 
I have a CommandButton bringing up a UserForm. On that
form, I want to display the contents of three cells, and
then display the sum of the other three cells. How do I
do this?

Tom Ogilvy

UserForm with Cell Data
 
private Sub CommandButton1_click()
With userform1
.Textbox1.Value = Range("A1").Text
.Textbox2.Value = Range("A2").Text
.Textbox3.Value = Range("A3").Text
.Textbox3.Value = Application.Sum(Range("A1:A3"))
.Show
End With
end Sub

--
Regards,
Tom Ogilvy


Phil Hageman wrote in message
...
I have a CommandButton bringing up a UserForm. On that
form, I want to display the contents of three cells, and
then display the sum of the other three cells. How do I
do this?




Phil Hageman

Thank You
 
Thanks, Tom - works fine!
-----Original Message-----
private Sub CommandButton1_click()
With userform1
.Textbox1.Value = Range("A1").Text
.Textbox2.Value = Range("A2").Text
.Textbox3.Value = Range("A3").Text
.Textbox3.Value = Application.Sum(Range("A1:A3"))
.Show
End With
end Sub

--
Regards,
Tom Ogilvy


Phil Hageman wrote in message
...
I have a CommandButton bringing up a UserForm. On that
form, I want to display the contents of three cells, and
then display the sum of the other three cells. How do I
do this?



.



All times are GMT +1. The time now is 09:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com