Good day,
Please help how to fix this only working when i search more than one.
problem 3.jpg and thisproblem 4.jpg
Private Sub cmdpo1_Click()
Dim a, i As Long, n As Long, w()
ActiveSheet.Unprotect ("@Chandria2017")
a = Sheets("DataList").Cells(1).CurrentRegion.Value
' nn = 10
For i = 1 To UBound(a, 1)
If CStr(a(i, 12)) = Me.txtmrf.Value Then
n = n + 1
ReDim Preserve w(1 To n)
w(n) = Application.Index(a, i, Array(13, 11, 22, 10, 35, 12))
End If
Next
If n > 0 Then
MsgBox "Record Found"
CmdSave.Enabled = True
If n > 1 Then
mrfList.listinbox.List = Application.Index(w, 0, 0)
mrfList.Show
Else
mrfList.Show
mrfList.listinbox.Column = w(0, 0)
End If
End If
If n = 0 Then
MsgBox "No Record Found"
End If
End Sub
'List box show if data is on the record
Private Sub listinbox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim i As Long, x
nn = nn + 1
x = Array("q", "U", "UP", "d", "PUR", "mrf")
'x = Array("q", "u", "p", "d", "mrf")
With mrfList.listinbox
For i = 0 To UBound(x)
frmMRR(x(i) & nn).Value = .List(.ListIndex, i)
Next
.RemoveItem .ListIndex
End With
End Sub
Bookmarks