variable that refernces the values in a text box

  • Thread starter Thread starter captbluefin
  • Start date Start date
C

captbluefin

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!
 
Try something like

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


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com (e-mail address removed)
 
Like a lot of things: It's easy once you know how. Thank You SO MUCH for
the quick help. Muchly appreciated!!!!
 
Back
Top