why show the frame of userform as the photo1

david2005wang

New Member
Joined
Apr 8, 2022
Messages
13
Office Version
  1. 2021
  2. 2019
  3. 2013
Platform
  1. Windows
Dear gents,

when i click the button of insert manufacturer,
the userform frame shows like the picture 1, which the right and bottom part is white color, but when I user mouse to move the form, the form will change to the nomal grey color as pic2 which shows the insert button.
The codes is running well in excel 2013, and I just use excel 2021 recently and find the above matter.

does any one meet the same matter? please instruct how to aovid that happening?

many thanks.

DW


====================================
Dim arr As Variant

Private Sub UserForm_Initialize()
Dim sht As Worksheet
Dim n As Long

Set sht = ThisWorkbook.Worksheets("Manufacture")
n = sht.Range("A" & sht.Rows.Count).End(xlUp).Row
arr = sht.Range("A2:A" & n)
Me.ListBox1.List = arr

End Sub

Private Sub TextBox1_Change()
Dim Search As String
Dim r As Long

Search = Me.TextBox1.Value

With Me.ListBox1
.Clear
If Len(Search) > 0 Then
For r = 1 To UBound(arr, 1) 'Ubound(arr,1) - UBound(arrayname, [ dimension ]) , 1 means 1 dimension. arr is 1 dimension array
If UCase(arr(r, 1)) Like "*" & UCase(Search) & "*" Then 'UCase - ignor the upper or lower case
.AddItem arr(r, 1)
End If
Next
Else
.List = arr
End If
End With

End Sub

Private Sub InsertCommandButton1_Click()
Application.ScreenUpdating = False
Dim i As Integer
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then 'if the row of i of the listbox selected
'Dim r
'r=cells(Row.Count.2).end(xlUp).Row+1
'Cells(r,1)=PlantListBox.List(I, 0)
ActiveCell.Offset(0, 0).Value = ListBox1.List(i, 0)
'ActiveCell.Offset(0, 1).Value = PlantListBox.List(i, 1)
ActiveCell.Offset(1, 0).Select
End If
Next
Application.ScreenUpdating = True

'Call SwitchMouseBWSheetsAndUserform

End Sub
 

Attachments

  • Picture1.png
    Picture1.png
    8.4 KB · Views: 17
  • Picture2.png
    Picture2.png
    9 KB · Views: 19
  • Picture3.png
    Picture3.png
    5.5 KB · Views: 14
  • Picture4.png
    Picture4.png
    39.5 KB · Views: 15

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,223,879
Messages
6,175,148
Members
452,615
Latest member
bogeys2birdies

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