Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Initialize textbox values
Hi,
I want to initialize all my textboxes when my userform is showed. The are all connected to the worksheet with controlsource. I tried using 'Me.txtSomebox.Value = 14' i the Userform_Initialize( event, but it doesn't change the value. If I write to the cell (range in the worksheet directly, it works. Why is this? It's alot clearer i I can set the value using the textbox name directly. Thanks in advance / phreu -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Initialize textbox values
Because you are tied to a worksheet, that is where it is getting the values
from. Why not just change the worksheet cells directly, rather than the textbox(es)? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "phreud " wrote in message ... Hi, I want to initialize all my textboxes when my userform is showed. They are all connected to the worksheet with controlsource. I tried using 'Me.txtSomebox.Value = 14' i the Userform_Initialize() event, but it doesn't change the value. If I write to the cell (range) in the worksheet directly, it works. Why is this? It's alot clearer if I can set the value using the textbox name directly. Thanks in advance / phreud --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Initialize textbox values
Since I got no answers, I'll try to clarify:
In my worksheet, I have in Cell A2 the value 10. In my UserForm I have a textbox (TextBox1) with ControlSource set t =A2 In UserForm_Initialize() I try to set: 'Me.TextBox1.Value = 14'. This does not change the value. It's still 10 when I run the code. If I however use this line 'Thisworkbook.Worksheets(1).Range("A2").Value = 14' it works fine. Can someone please explain why? / phreu -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Initialize textbox values
I replied, and this was what I wrote
Because you are tied to a worksheet, that is where it is getting the values from. Why not just change the worksheet cells directly, rather than the textbox(es)? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "phreud " wrote in message ... Since I got no answers, I'll try to clarify: In my worksheet, I have in Cell A2 the value 10. In my UserForm I have a textbox (TextBox1) with ControlSource set to =A2 In UserForm_Initialize() I try to set: 'Me.TextBox1.Value = 14'. This does not change the value. It's still 10 when I run the code. If I however use this line: 'Thisworkbook.Worksheets(1).Range("A2").Value = 14' it works fine. Can someone please explain why? / phreud --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Initialize textbox values
Bob Phillips wrote:
[b]Because you are tied to a worksheet, that is where it is gettin the values from. Why not just change the worksheet cells directly, rather than the textbox(es)? That's what I had to do. I just thought it should work the other wa too. It's a whole lot clearer to type: txtInitialCost.Value = 44 than: Thisworkbook.Range("B45").Value = 44 I was initializing up towards 50 values, so it would have been alo easier -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do you initialize the values in a circular reference? | Excel Discussion (Misc queries) | |||
Userform Initialize & combo box values | Excel Discussion (Misc queries) | |||
How do I add TextBox.values? | Excel Discussion (Misc queries) | |||
How do I add TextBox.values? | Excel Worksheet Functions | |||
Initialize data in new row? | Excel Programming |