ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Form Question (https://www.excelbanter.com/excel-programming/314947-user-form-question.html)

tony

User Form Question
 
I have a section of my program that will display a different user form
depending on what a given input was (NT1s). I know that following will work
to display the correct form but I was wondering if there was a way to use the
variable "NT1s" in a single line to show the correct form. Something like
ModConfig(NT1).Show

As always, any help is greatly appreciated!

If NT1s = 1 Then
ModConfig1.Show
End If
If NT1s = 2 Then
ModConfig2.Show
End If
If NT1s = 3 Then
ModConfig3.Show
End If
If NT1s = 4 Then
ModConfig4.Show
End If

Stephen Bullen[_4_]

User Form Question
 
Hi Tony,

Something like
ModConfig(NT1).Show

As always, any help is greatly appreciated!

If NT1s = 1 Then
ModConfig1.Show
End If
If NT1s = 2 Then
ModConfig2.Show
End If
If NT1s = 3 Then
ModConfig3.Show
End If
If NT1s = 4 Then
ModConfig4.Show
End If


Su

VBA.Userforms("ModConfig" & NT1s).Show

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk




All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com