Pass value between two user forms - but txt box and form name held as public variables

Storm8585

New Member
Joined
Sep 5, 2014
Messages
47
Hi all,
I need to pass a value from a text box (frmkeypad.tbvalue.value) to another text box in another userform. But the form name and text box name to pass it to are stored as public variables (formref and fieldref). So something like formref & "." & fieldref & ".value" = frmkeypad.tbvalue.value

Help!
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Storm8585

New Member
Joined
Sep 5, 2014
Messages
47
Hi all,
I need to pass a value from a text box (frmkeypad.tbvalue.value) to another text box in another userform. But the form name and text box name to pass it to are stored as public variables (formref and fieldref). So something like formref & "." & fieldref & ".value" = frmkeypad.tbvalue.value

Help!
All - solved it. Duh! set them as strings not as Userform and Object...
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,044
Office Version
365
Platform
Windows
... you could do something like this

- declare a public variable (tbVAR ?) to hold the original textbox value
- update that variable as you leave first userform
- and then use that variable when writing the value to the textbox in the second userform (possibly in Userform_Initialize)
Code:
textbox99.Value = tbVAR
EDIT
I see you have already fixed things so you can ignore this
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,099,472
Messages
5,468,823
Members
406,612
Latest member
pedad

This Week's Hot Topics

Top