ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cell value to text box? (https://www.excelbanter.com/excel-programming/363246-cell-value-text-box.html)

tomro1

cell value to text box?
 

i'm having problems with getting a cell value into a textbox in a
userform.

my problem is that i am trying to get a cell value in a worksheet
displayed into a textbox in my userform with vba but can't find the
right code.

any ideas?

:)


--
tomro1
------------------------------------------------------------------------
tomro1's Profile: http://www.excelforum.com/member.php...o&userid=35081
View this thread: http://www.excelforum.com/showthread...hreadid=548293


KellTainer[_2_]

cell value to text box?
 

Try this in the event procedure that you activate to transfer the value

Lets say your UserForm = UserForm1
and TextBox = TextBox1
and Sheet = Sheet1

UserForm1.TextBox1.Value = Sheet1.Range("A1").Value


--
KellTainer
------------------------------------------------------------------------
KellTainer's Profile: http://www.excelforum.com/member.php...o&userid=34322
View this thread: http://www.excelforum.com/showthread...hreadid=548293


tomro1[_2_]

cell value to text box?
 

KellTainer Wrote:

UserForm1.TextBox1.Value = Sheet1.Range("A1").Value



it still has a problem with "sheet1", he doesn't recognizes it.

i also have tried

textbox1.value = sheets("sheet1") range("a1").value

but also doens't work


--
tomro1
------------------------------------------------------------------------
tomro1's Profile: http://www.excelforum.com/member.php...o&userid=35081
View this thread: http://www.excelforum.com/showthread...hreadid=548293


KellTainer[_3_]

cell value to text box?
 

hmm, you have to modify the code to suit your needs. just change the
different variables to suit your application.


--
KellTainer
------------------------------------------------------------------------
KellTainer's Profile: http://www.excelforum.com/member.php...o&userid=34322
View this thread: http://www.excelforum.com/showthread...hreadid=548293


[email protected]

cell value to text box?
 
It is possible to change the name of the sheet in the VBE environment
under the properties of the worksheet object. This name is different
from the name you give a sheet via the tab in excel. Normally the first
sheet can always be referenced as "sheet1" unless the internal name has
been altered. To check this go to the VBE and look at the properties
box for the sheet you need to work with. The first property listed will
be (name) and it's value is what you want to use in place of "sheet1".
In the future I would avoid changing this name property unless you
really need to (if that turns out to be the problem)

Hope this helps.


tomro1 wrote:
KellTainer Wrote:

UserForm1.TextBox1.Value = Sheet1.Range("A1").Value



it still has a problem with "sheet1", he doesn't recognizes it.

i also have tried

textbox1.value = sheets("sheet1") range("a1").value

but also doens't work


--
tomro1
------------------------------------------------------------------------
tomro1's Profile: http://www.excelforum.com/member.php...o&userid=35081
View this thread: http://www.excelforum.com/showthread...hreadid=548293



tomro1[_3_]

cell value to text box?
 

Wrote:
It is possible to change the name of the sheet in the VBE environment
under the properties of the worksheet object. This name is different
from the name you give a sheet via the tab in excel. Normally the
first
sheet can always be referenced as "sheet1" unless the internal name
has
been altered. To check this go to the VBE and look at the properties
box for the sheet you need to work with. The first property listed
will
be (name) and it's value is what you want to use in place of "sheet1".
In the future I would avoid changing this name property unless you
really need to (if that turns out to be the problem)

Hope this helps.
[/url]
[/color]

i used the proper names but the formula didn't work, so tried something
else, and nog its works:cool:


Worksheets("sheet1").Activate
Range("a1").Select
TextBox1.Text = ActiveCell.Value


--
tomro1
------------------------------------------------------------------------
tomro1's Profile:
http://www.excelforum.com/member.php...o&userid=35081
View this thread: http://www.excelforum.com/showthread...hreadid=548293


abhi

cell value to text box?
 
try this:
UserForm1.TextBox1.Value =
excel.application.activewindow.activesheet.range.( "A1").Value


tomro1 wrote:
Wrote:
It is possible to change the name of the sheet in the VBE environment
under the properties of the worksheet object. This name is different
from the name you give a sheet via the tab in excel. Normally the
first
sheet can always be referenced as "sheet1" unless the internal name
has
been altered. To check this go to the VBE and look at the properties
box for the sheet you need to work with. The first property listed
will
be (name) and it's value is what you want to use in place of "sheet1".
In the future I would avoid changing this name property unless you
really need to (if that turns out to be the problem)

Hope this helps.
[/url]


i used the proper names but the formula didn't work, so tried something
else, and nog its works:cool:


Worksheets("sheet1").Activate
Range("a1").Select
TextBox1.Text = ActiveCell.Value


--
tomro1
------------------------------------------------------------------------
tomro1's Profile:
http://www.excelforum.com/member.php...o&userid=35081
View this thread: http://www.excelforum.com/showthread...hreadid=548293
[/color]



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

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