Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-16-2018, 03:22 PM
jrooney7 jrooney7 is offline Adjust userform layout based on combobox selection Windows 7 64bit Adjust userform layout based on combobox selection Office 2013
Novice
Adjust userform layout based on combobox selection
 
Join Date: Sep 2018
Posts: 23
jrooney7 is on a distinguished road
Default Adjust userform layout based on combobox selection

Hello all,

I have a userform with multiple textboxes and comboboxes. I have set some to be hidden when the userform is run, and then want them to become visible if certain selections are made in the userform comboboxes. The example below is from the same userform in Excel, and it works there, but it is not working in Word. Any thoughts?

Code:
Private Sub SafetiesComboBox_Change()
    Select Case SafetiesComboBox.Value
    
    Case "Other/Multiple"
        FirearmPreFireUserForm.SafetiesTextBox.Visible = True
        SafetiesTextBox.Top = SafetiesComboBox.Top + SafetiesComboBox.Height
        SingleActionTP.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 6.5
        SAL.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 6.5
        SingleActionLowTextBox.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 4.5
        SAH.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 6.5
        SingleActionHighTextBox.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 4.5
        DoubleActionTP.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 24.5
        DAL.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 24.5
        DoubleActionLowTextBox.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 22.5
        DAH.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 24.5
        DoubleActionHighTextBox.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 22.5
        HybridActionTP.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 43.5
        HAL.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 43.5
        HybridActionLowTextBox.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 40.5
        HAH.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 43.5
        HybridActionHighTextBox.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 40.5
        Tests.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 4.5
        TestAmmo.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 4.5
        TestsComboBox.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 16.5
        TestAmmoTextBox.Top = SafetiesTextBox.Top + SafetiesTextBox.Height + 16.5
        Notes.Top = TestsComboBox.Top + TestsComboBox.Height + 12
        NotesTextBox.Top = TestsComboBox.Top + TestsComboBox.Height + 10
        Results.Top = NotesTextBox.Top + NotesTextBox.Height + 6.5
        ResultsTextBox.Top = NotesTextBox.Top + NotesTextBox.Height + 4.5
        FirearmCommandButton1.Top = ResultsTextBox.Top + ResultsTextBox.Height + 22.5
        FirearmCommandButton2.Top = ResultsTextBox.Top + ResultsTextBox.Height + 22.5
        FirearmPreFireUserForm.ScrollHeight = FirearmCommandButton1.Top + FirearmCommandButton1.Height + 28
                
    Case Else
        FirearmPreFireUserForm.SafetiesTextBox.Visible = False
        SingleActionTP.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 6.5
        SAL.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 6.5
        SingleActionLowTextBox.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 4.5
        SAH.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 6.5
        SingleActionHighTextBox.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 4.5
        DoubleActionTP.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 24.5
        DAL.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 24.5
        DoubleActionLowTextBox.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 22.5
        DAH.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 24.5
        DoubleActionHighTextBox.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 22.5
        HybridActionTP.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 43.5
        HAL.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 43.5
        HybridActionLowTextBox.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 40.5
        HAH.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 43.5
        HybridActionHighTextBox.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 40.5
        Tests.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 4.5
        TestAmmo.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 4.5
        TestsComboBox.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 16.5
        TestAmmoTextBox.Top = SafetiesComboBox.Top + SafetiesComboBox.Height + 16.5
        Notes.Top = TestsComboBox.Top + TestsComboBox.Height + 12
        NotesTextBox.Top = TestsComboBox.Top + TestsComboBox.Height + 10
        Results.Top = NotesTextBox.Top + NotesTextBox.Height + 6.5
        ResultsTextBox.Top = NotesTextBox.Top + NotesTextBox.Height + 4.5
        FirearmCommandButton1.Top = ResultsTextBox.Top + ResultsTextBox.Height + 22.5
        FirearmCommandButton2.Top = ResultsTextBox.Top + ResultsTextBox.Height + 22.5
        FirearmPreFireUserForm.ScrollHeight = FirearmCommandButton1.Top + FirearmCommandButton1.Height + 28
        
End Select

End Sub

Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill userform, combobox and frame based on data from multiple worksheets Divinedar Excel Programming 8 04-26-2018 05:07 PM
Value of Combobox in other userform Vibov Excel Programming 4 11-19-2015 04:12 AM
Inserting a particular image based on a combobox selection LeonieD PowerPoint 2 06-27-2014 05:39 PM
how to populate textbox based on combobox selection in word IvanGeorgiev Word 1 02-21-2013 07:32 PM
Adjust userform layout based on combobox selection how to populate textbox based on combobox selection in word IvanGeorgiev Word VBA 1 02-21-2013 07:28 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:35 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft