minimize and maximize the userform based on values showing in textboxes

Ali M

Active Member
Joined
Oct 10, 2021
Messages
290
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
Hi experts,
I want minimizing and maximizing the userform based on values showing in tools . just show the textboxes on userform contains values when run the userform and ignore textboxes are empty


this is what I got when run the userform
1.PNG



what I want if each three textboxes are empty shouldn't show like this

2.PNG

note: if one or two of for each three textboxes contains value then shouldn't show.

thanks
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
@EXCEL MAX

why specify 16,17,18 , what means?

you did it by looping in all of the text boxes in first lines.
 
Upvote 0
We assume you have 15 textboxes that you want to manipulate.
The names of these three textboxes are examples of names and represent any other text box
that may affect the collection of the main textboxes.
Collecting names in a array makes the code shorter.
Also, this routine gives you the opportunity to use more than 15 textboxes and
you don't have to worry about naming textboxes and their order.
 
Upvote 0
@dmt32 I've finished based on your guiding

sorry having senior moments posted the wrong version - can you delete & replace with following

VBA Code:
Public BoxSpace     As Double, BoxHeight As Double, BoxWidth As Double
Public LineCount    As Long
Dim ws              As Worksheet

Private Sub UserForm_Activate()
     DisplayTextBoxes Me
End Sub

Private Sub UserForm_Initialize()
    
    Set ws = ThisWorkbook.Worksheets("DATA")
    
    ConfigureForm Me
    
    GetRecord Me, ws
    
End Sub

when done let me know & will post the module codes

Dave
 
Upvote 0
@EXCEL MAX I'm still confused !! can ignore
VBA Code:
Not vCtrl.Name = "TextBox16" And _
         Not vCtrl.Name = "TextBox17" And _
         Not vCtrl.Name = "TextBox18"
as far as I know when use loop throught the textboxes I don't need indicating for each name textbox
just satisfy for this?
VBA Code:
If TypeName(vCtrl) = "TextBox"
and I have question your code works for the listbox or just textboxes and lables ?
 
Upvote 0
@dmt32 just notes . you said
  • insert 3 standard modules & name them as follows
  • ConfigureForm_Code
  • DisplayTextBoxes_Code
  • GetRecord_Code
but why when call the modules should n't call the whole name as your code
I mean like this
VBA Code:
ConfigureForm_Code Me
 GetRecord_Code Me, ws
DisplayTextBoxes_Code Me
 
Upvote 0
@dmt32 just notes . you said

but why when call the modules should n't call the whole name as your code
I mean like this
VBA Code:
ConfigureForm_Code Me
 GetRecord_Code Me, ws
DisplayTextBoxes_Code Me

You call the procedure name - Word "Code" at end is just a module naming convention & just indicates its code for that procedure.

Have you replace code with code in #post 34?

Dave
 
Upvote 0

Sorry to mess about but I omitted a variable

Rich (BB code):
Public BoxSpace     As Double, BoxHeight As Double, BoxWidth As Double
Public LineCount    As Long, TextBoxCount As Long
Dim ws              As Worksheet

Please update

Dave
 
Upvote 0

Forum statistics

Threads
1,215,532
Messages
6,125,358
Members
449,221
Latest member
chriscavsib

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