ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   variable that refernces the values in a text box (https://www.excelbanter.com/excel-programming/281061-variable-refernces-values-text-box.html)

captbluefin[_2_]

variable that refernces the values in a text box
 

This problem is easiest explained by looking at the next line of code
from a command button on a form:

ActiveCell.Value = "txtTest1" + ".Value"

When I look at active cell the words txtTest1.Value are in the cell.

What I want to be in the cell is the data that is in the text box
itself.

If I type Hello into the forms text box that is named txtTest1, I would
like the active cell of the active sheet to contain the word Hello.

Why: there are 30 text boxes on the form I am working on (txtTest1
...txtTest30). I want to use a counter to reference the contents of:
txtTest1 txtTest2 txtTest3 .......

Any help would be greatly appreciated. I've tried everything I can
think of. Made myself batty trying to figure out what I am doing
wrong!


--
captbluefin
------------------------------------------------------------------------
captbluefin's Profile: http://www.excelforum.com/member.php...fo&userid=1479
View this thread: http://www.excelforum.com/showthread...hreadid=162451


Chip Pearson

variable that refernces the values in a text box
 
Try something like

ActiveCell.Value = UserForm1.Controls("textbox1").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"captbluefin" wrote in message
...

This problem is easiest explained by looking at the next line of code
from a command button on a form:

ActiveCell.Value = "txtTest1" + ".Value"

When I look at active cell the words txtTest1.Value are in the cell.

What I want to be in the cell is the data that is in the text box
itself.

If I type Hello into the forms text box that is named txtTest1, I would
like the active cell of the active sheet to contain the word Hello.

Why: there are 30 text boxes on the form I am working on (txtTest1
..txtTest30). I want to use a counter to reference the contents of:
txtTest1 txtTest2 txtTest3 .......

Any help would be greatly appreciated. I've tried everything I can
think of. Made myself batty trying to figure out what I am doing
wrong!


--
captbluefin
------------------------------------------------------------------------
captbluefin's Profile:

http://www.excelforum.com/member.php...fo&userid=1479
View this thread: http://www.excelforum.com/showthread...hreadid=162451




captbluefin[_3_]

variable that refernces the values in a text box
 

Like a lot of things: It's easy once you know how. Thank You SO MUCH for
the quick help. Muchly appreciated!!!!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



All times are GMT +1. The time now is 02:38 PM.

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