VBA

Moderators: PavlinII
Number of threads: 1671
Number of posts: 3076

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
want my code to find all data needed Posted by suny100 on 17 May 2011 at 3:59 PM
i need my code to find all data i seach for , my code is working well but find just one target
Private Sub CommandButton8_Click()
Dim valFIND     As Range
Dim iRow        As Long
Dim sB          As String

    For iRow = 2 To 500
        If Cells(iRow, "E") = "1" Then
            sB = Cells(iRow, "B").Value
            On Error Resume Next
            Set valFIND = Sheet4.Cells.Find(sB, LookIn:=xlValues, LookAt:=xlWhole)
            If Not valFIND Is Nothing Then
                Sheet4.Activate
                valFIND.Select
                Exit Sub
            End If
        End If
    Next iRow
    
    MsgBox "Value " & sB & " was not found"
End Sub




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.