Hello again!
I have a question concerning the Select Case Method. In the following code, I have used this method to place the proper text in each textbox. The code works fine. What I am wondering is whether there is another way to use the Select Case Method that would take less space.
Code
Sub CreateControls()
Dim NewControl As OLEObject
Dim Holder As Variant
Dim Holder2 As Variant
Dim i As Integer
Application.ScreenUpdating = False
Set NewControl = Application.ActiveSheet.OLEObjects.Add(ClassType:="Forms.LABEL.1", _
Left:=22.5, Top:=109.75, Width:=642.75, Height:=344.25)
NewControl.Name = "MBL"
NewControl.Shadow = True
With NewControl.Object
.BackColor = &H8000000C
.SpecialEffect = 1
.Caption = ""
End With
Holder = 0
Holder2 = 100
For i = 1 To 20
Set NewControl = Application.ActiveSheet.OLEObjects.Add(ClassType:="Forms.textbox.1", _
Left:=27.75, Top:=Holder2 + 16.5, Width:=124.5, Height:=16.5)
Holder = Holder + 1
Holder2 = NewControl.Top
NewControl.Name = ("ML" & i)
NewControl.Shadow = True
With NewControl.Object
.BackColor = &H80000014
.SpecialEffect = 1
.TextAlign = 2
.Font.Size = 8
.Font.Bold = True
Select Case Holder
Case Is = 1
.Text = "Scaffold Buggy"
Case Is = 2
.Text = "Left Swing Gate"
Case Is = 3
.Text = "Right Swing Gate"
Case Is = 4
.Text = "6' Truss Bearer"
Case Is = 5
.Text = "7' Truss Bearer"
Case Is = 6
.Text = "8' Truss Bearer"
Case Is = 7
.Text = "9' Truss Bearer"
Case Is = 8
.Text = "10' Truss Bearer"
Case Is = 9
.Text = "16' Truss Bearer"
Case Is = 10
.Text = "18' Truss Bearer"
Case Is = 11
.Text = "21 inch Screw Jack"
Case Is = 12
.Text = "Swivel Jack"
Case Is = 13
.Text = "2' Mudsill"
Case Is = 14
.Text = "4' Wooden Board"
Case Is = 15
.Text = "6' Wooden Board"
Case Is = 16
.Text = "8' Wooden Board"
Case Is = 17
.Text = "10' Wooden Board"
Case Is = 18
.Text = "6' Ladder"
Case Is = 19
.Text = "3' Ladder"
Case Is = 20
.Text = "Ladder Bracket"
End Select
End With
Holder2 = NewControl.Top
Next i
Application.ScreenUpdating = True
End Sub
Display More
In other words, is this possible:
Code
Select Case Holder
Case Is = 1, .Text = "Scaffold Buggy", Is = 2, .Text = "Left Swing Gate", Is = 3, .Text = "Right Swing Gate"
End Select
As always, I am very grateful for your help in the past as well as any help someone may currently provide.