Userform; open textbox, close it and after that register it

Bandito1

Board Regular
Joined
Oct 18, 2018
Messages
233
Office Version
  1. 2016
Platform
  1. Windows
Hello all,

See below, this is part of my userform.
I would like to store comments behind the comboboxes (the blue "+").

When the "+" is pressed a new userform is opened with a textbox
I would like that a user is able to type his comment in the textbox, close it and then continues on the userform that is shown below.
The user can reopen the comments by pressing the "+" again.

when he is done and presses add observation the comments are also stored.

I know how to store data from textbox on the worksheet but i have no idea how to "temporary" store the value in a textbox.
Someone gave the tip to use array but i don't know where to start

attachment 1.PNG
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
You can have a public string declared.
Above your code, after the imports (if you have any) and before you run into any subs, put this

VBA Code:
Public TempString as String

Now anywhere in your code you can reference that. I would recommend you put it in a module instead of a userform because you can call a module at any time. To call from a userform you will need to open the userform to call it.

Example:

VBA Code:
Dim ThisString as String
ThisString = Userform1.TempString

from a module you just call it like any other string.
 
Upvote 0
Hi,
Have a look at using the Controls Tag Property :Tag property

which can hold your comments whilst your form remains in memory.

Dave
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,613
Members
449,090
Latest member
vivek chauhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top