+ Reply to Thread
Results 1 to 1 of 1

Please help only working when Search only more than 1

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-04-2017
    Location
    Phillipines
    MS-Off Ver
    2016
    Posts
    169

    Please help only working when Search only more than 1

    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
    Last edited by Chandria; 08-05-2018 at 07:47 PM. Reason: additional code

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] My =IF(ISNUMBER(SEARCH Formula is Not Working
    By thanhie in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-03-2022, 12:30 AM
  2. Search through database not working
    By jay11 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-02-2017, 01:17 AM
  3. Search and Edit Form, Search not working correctly
    By rob_h in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-23-2017, 03:48 PM
  4. IF(count(search) Function not working when search from text from a cell
    By joshnathan in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-09-2013, 05:13 AM
  5. [SOLVED] Search and Replace not working
    By jshaw82 in forum Excel General
    Replies: 3
    Last Post: 07-08-2013, 04:11 PM
  6. Search code not working
    By vampyr07au in forum Access Programming / VBA / Macros
    Replies: 1
    Last Post: 05-01-2011, 08:23 AM
  7. workbook search stoped working
    By TheNewGuy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-11-2009, 02:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1