Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
How do you initialize the values in a circular reference? turbosteve Excel Discussion (Misc queries) 4 July 16th 10 06:06 AM
Userform Initialize & combo box values michaelberrier Excel Discussion (Misc queries) 3 June 27th 06 04:35 PM
How do I add TextBox.values? WTG Excel Discussion (Misc queries) 1 February 27th 05 08:25 PM
How do I add TextBox.values? WTG Excel Worksheet Functions 1 February 27th 05 08:22 PM
Initialize data in new row? Ken[_12_] Excel Programming 1 August 9th 03 05:13 PM


All times are GMT +1. The time now is 10:25 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"