Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default userform and spreadsheet formulas

hello:
I have a =SUM(k1:k93) in cell K94 along with some other formulas referencing
other cells.
I created a userform and added a command button at top of spreadsheet
labeled "Get Weight Summary"
The command button has a macro assigned:
Sub command_button2_click()
userform1.show
end sub

On the userform I added a textbox and set my properties for the
controlsource of this textbox to read =sheet1!k94 and when I ran the userform
macro the textbox appeared with the same value in it as on sheet1!K94 cell.
The problem is it took out my formula on Sheet1!K94 and changed it to a value
or number.
How can I reference this cell on the userform without having it erase my
formulas on Sheet1?
I did a test and erased the textbox on the user form and renetered the
formula =SUM(K1:K93) in cell K94 and it retained the formula. It seems when I
reference this cell on the userform using the textbox it converts my formulas
to plain numbers.
Any suggestions?
He4Giv
--
He4Giv (Dick)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default userform and spreadsheet formulas

Private Sub CommandButton2_Click()

UserForm1.Show
UserForm1.TextBox1.Value = Range("K94").Text

End Sub


Make sure you use the Text property of Range("K94"), not the value
property.

The reason that the original form removed the cell formula is because
the cell <== control binding is a 2-way relationship. When you change
the value or close the form, the cell gets updated with the control's
value, which in this case was a plain number.

Nick Hebb
http://www.breezetree.com

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
userform for spreadsheet spreadsheets/userforms Excel Discussion (Misc queries) 1 May 20th 05 12:18 PM
Userform to spreadsheet Aashi Excel Programming 2 April 25th 04 03:29 PM
userform data to spreadsheet Priya[_2_] Excel Programming 2 April 24th 04 09:50 PM
spreadsheet on userform alcorjr Excel Programming 2 December 15th 03 07:19 PM
Spreadsheet in an Userform Lukas Rüttimann Excel Programming 0 September 23rd 03 05:06 PM


All times are GMT +1. The time now is 12:10 PM.

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"