variable that refernces the values in a text box

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!
 
C

Chip Pearson

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)
 
C

captbluefin

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top