david2005wang
New Member
- Joined
- Apr 8, 2022
- Messages
- 13
- Office Version
- 2021
- 2019
- 2013
- Platform
- 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
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