Frames overlap

R1zz0

New Member
Joined
Mar 16, 2019
Messages
7
Hi please consult.
I have a UserForm and a Combobox interface. There are conditions in the ComboBox. which when they come true. TextBox appears in the frame.
The problem is the one. that when you return in terms of conditions. Frames overlap. How to fix it? A snippet is attached.

Code:
Private Sub slpceDH()
   
'Sloupec D:H
  Dim TBD As MSForms.TextBox
  Dim lbD As MSForms.Label
    Set NewFrameDH = Me.Controls.Add("Forms.Frame.1")
    Set lbD = NewFrameDH.Controls.Add("Forms.Label.1")
    Set lbE = NewFrameDH.Controls.Add("Forms.Label.1")
    Set lbF = NewFrameDH.Controls.Add("Forms.Label.1")
    Set lbG = NewFrameDH.Controls.Add("Forms.Label.1")
    Set lbH = NewFrameDH.Controls.Add("Forms.Label.1")
    Set TBD = NewFrameDH.Controls.Add("Forms.TextBox.1")
    Set TBE = NewFrameDH.Controls.Add("Forms.TextBox.1")
    Set TBF = NewFrameDH.Controls.Add("Forms.TextBox.1")
    Set TBG = NewFrameDH.Controls.Add("Forms.TextBox.1")
    Set TBH = NewFrameDH.Controls.Add("Forms.TextBox.1")
'Začátek scrollbaru
'With NewFrameDG
        '.ScrollBars = fmScrollBarsVertical
        'Change 8.5 to suit your needs
        '.ScrollHeight = .InsideHeight * 8.5
        '.ScrollWidth = .InsideWidth * 9
    'End With
  'Konec scrollbaru


NewFrameDH.Top = 30
NewFrameDH.Left = 6 ' from the left border of frame1
NewFrameDH.Caption = "Sloupce D:F"
NewFrameDH.Height = 120
NewFrameDH.Width = 139


lbD.Top = 13
lbD.Left = 5
lbD.Caption = "Sloupec D: "
TBD.Top = 10
TBD.Left = 47


lbE.Top = 33
lbE.Left = 5
lbE.Caption = "Sloupec E: "
TBE.Top = 30
TBE.Left = 47


lbF.Top = 53
lbF.Left = 5
lbF.Caption = "Sloupec F: "
TBF.Top = 50
TBF.Left = 47


lbG.Top = 73
lbG.Left = 5
lbG.Caption = "Sloupec G: "
TBG.Top = 70
TBG.Left = 47


lbH.Top = 93
lbH.Left = 5
lbH.Caption = "Sloupec H: "
TBH.Top = 90
TBH.Left = 47


If rozsah.Value = "D4:H4" Then
NewFrameDH.Visible = True
Else
NewFrameDH.Visible = False
End If
End Sub






Private Sub rozsah_Change()
If rozsah.Value = "D4:E4" Then Call slpceDE
If rozsah.Value = "D4:F4" Then Call slpceDF
If rozsah.Value = "D4:G4" Then Call slpceDG
If rozsah.Value = "D4:H4" Then Call slpceDH


End Sub






Private Sub ulozit_Click()
On Error GoTo EndSub
ActiveSheet.ListObjects.Add(xlSrcRange, Range(rozsah.Value), , xlYes).Name = "Tabulka"
Unload Me
EndSub: End Sub


Private Sub UserForm_Initialize()


With rozsah
   .AddItem "D4:E4"
   .AddItem "D4:F4"
   .AddItem "D4:G4"
   .AddItem "D4:H4"
   .AddItem "D4:I4"
   .AddItem "D4:J4"
   .AddItem "D4:K4"
   .AddItem "D4:L4"
   .AddItem "D4:M4"
   .AddItem "D4:N4"
   .AddItem "D4:O4"
   .AddItem "D4:P4"
   .AddItem "D4:Q4"
   .AddItem "D4:R4"
   .AddItem "D4:S4"
   .AddItem "D4:T4"
   .AddItem "D4:U4"
   .AddItem "D4:V4"
End With
End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,213,543
Messages
6,114,240
Members
448,555
Latest member
RobertJones1986

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