Relative Content

Tag Archive for excelvbauserform

How to create automatic code in userform VBA?

I’m doing an inventory userform. I need to create an automatic code for each item that is registered. Say, Item 1 – P0001, Item 2 – P0002, and so on. I’ve tried adding a string “P” to the number, but it won’t work.
How can I do this?

Textbox focus moving strangely in multipage VBA Userforms

I have a multipage form that I want to use for setup for a data analysis macro. I want some textboxes to show a warning label if the user exits them without entering a valid value, so I used the textbox_exit() event to set the label to visible if the textbox doesn’t contain a valid value. The issue is that the focus always starts on the tab of the multipage, but whenever I click on a textbox, the focus always goes to one particular textbox for a moment before moving to the textbox I selected. The focus goes to the textbox I created first, regardless of name, position on the multipage or location of its code in the program. This sets off the warning label for that textbox, which I don’t want to have happening.

How to force textbox exit event when closing a userform

I have a userform with input textboxes. I need to force validation on the textboxes, which I use the Exit event to do. The issue I have is that someone can enter data into one of the textboxes and then click my Close button without moving to another field. This bypasses the exit event. Here is a sample textbox exit event.

Userform Excel vba page enlarged

I have this problem and I hope someone could help me.
I have a spredsheet with several command buttons.
On the first sheet I have a block for first rows and columns.
Because of first sheet has about 150 rows and 400 columns, I need to block first rows and columns.
Well, sometimes, (not always), when I click on a command button that shows a Userform, the entire page below is enlarged. When I close Userform, entire blocks of cells disappear.
In this case, I have to close the workbook or to turn off the block of the rows.
In fact, If a turn off the block of the first rows and columns, problem instantly disappears.
Does someone know how to fix this problem?