Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code for transfering cell value to text box.
Need some help getting the value of a cell to show up in a text box.
The cell "C13" contains a formula that calculates it's value from 3 other cells. These cells recieve their value as data is entered into corresponding text boxes. I tried linking the textbox to the cell by control source but I quickly found out that it will override the formula in the cell. How can I get the cell value to show up in the text box? Ideally I would like it to show up automatically when the cell's value changes, without having to associate it with an event. Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code for transfering cell value to text box.
Matt,
Below is the code which will do the work ... Option Explicit Private Sub TextBox1_Change() 'if Cell F5 contains the final calculation TextBox1.Text = Range("F5").Value End Sub Private Sub Worksheet_Change(ByVal Target As Range) Call TextBox1_Change End Sub HTH Carim |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code for transfering cell value to text box.
Thanks for your help Carim. The code works but not exactly as I'd
planned. TextBox1 isn't populated until I focus on it and hit any key, then it updates. Ideally, it would update immediately after the cells that "F5" uses for the calculation are populated. Clear as mud? Any ideas? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code for transfering cell value to text box.
Matt,
For automatic update, make sure in the sheet object to have : Private Sub Worksheet_Change(ByVal Target As Range) Call TextBox1_Change End Sub Cheers |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code for transfering cell value to text box.
Carim thanks once again. In case you can't tell I'm a novice at this
you'll know now... Where can I find the sheet objective to insert the code? thanks |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code for transfering cell value to text box.
Matt,
Double click the sheet (the one that contains the results cell) in project explorer (ALT + F11 to bring this up - see the left hand side of the screen) - click on the down arrow on the box that will say "(General)" (it's at the top of the screen on the main code window)and you should see the word Worksheet. Click on this and the right drop down dialogue will change the list of available declarations. From here, click on the drop down arrow on this right dialogue box and select CHANGE This will bring up the code: Private Sub Worksheet_Change(ByVal Target As Range) End Sub Stick the "Call Textbox1_change" code in between these two lines. Hope this helps, B |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
transfering cell values progressively through worksheets | Excel Worksheet Functions | |||
Transfering one cell of word to excel | Excel Discussion (Misc queries) | |||
Transfering informationfrom one cell to another | Links and Linking in Excel | |||
transfering information from one cell to another | Excel Worksheet Functions | |||
Transfering information to the next free cell in a column | Excel Discussion (Misc queries) |