+ Reply to Thread
Results 1 to 7 of 7

VB Code to look for certain data and bring related data

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code to look for certain data and bring related data

    Hello:
    Please refer to attached file.
    I have downloaded Bank Statement and data are shown in column A thru G.
    I will have Payroll Data in column O thru T.

    I need VB Code to go thru each check # in column C and find the name of the Payee from column R for correpsoning check # in column O.
    Will need to confirm check # in column C and amount in column G with Check # in column O and Amount in column S.
    Once name of the payee is found then enter in column D and add "Payroll:Net" in column E as shown in yellow highlighted.


    Let me know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,405

    Re: VB Code to look for certain data and bring related data

    .
    The checks values match EXCEPT most of them have a NEGATIVE sign in front (Col G). Does the NEGATIVE sign need to remain or are you intending to remove the NEGATIVE sign first then
    proceed with the matching ?

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,405

    Re: VB Code to look for certain data and bring related data

    .
    If changing the numbers in Col G to positive is acceptable, this macro will accomplish the goal :

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! try this demonstration ‼


    According to the attachment as it is, a VBA starter :

    PHP Code: 
    Sub Demo1()
        
    Dim VR&, Rf As Range
            V 
    Application.Index([A1].CurrentRegionEvaluate("ROW(1:" & [C1].End(xlDown).Row ")"), [{3,7}])
            
    Application.ScreenUpdating False
        With Range
    ("O2", [O1].End(xlDown))
            For 
    2 To UBound(V)
                   
    Set Rf = .Find(V(R1), , , xlWhole)
                If 
    Not Rf Is Nothing Then
                    Cells
    (R4) = Rf(14).Text
                    
    If Abs(V(R2)) = Rf(15).Value2 Then Cells(R5) = "Payroll:Net"
                
    End If
            
    Next
        End With
            Application
    .ScreenUpdating True
            Set Rf 
    Nothing
    End Sub 
    ► Do you like it ? ► ► So thanks to click on bottom left star icon « Add Reputation » ! ◄ ◄

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to look for certain data and bring related data

    Hello:

    Marc L : I will be using your code, i see small problem.
    Please refer to attached file, Sheet2.
    This is the result after running your code.
    Works with small issue.

    Need to verify check# and Amount

    Look at the highlighted one.
    170.3 compared with 171.3 which does not match so in this case, do not change..

    Would appreciate if you can help modify to code to accomplish this.


    Let me know if you have any questions.
    Thanks.

    R
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: VB Code to look for certain data and bring related data


    Not an issue from my code as it runs as expected according to the original explanation & attachment
    and as you can easily check yourself following these directions :

    • Copy cell E20 to E21 or just make blank cell E21

    • Execute my demonstration …

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to look for certain data and bring related data

    Hello Marc L

    I see it, Thanks

    Riz

+ 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] VB Code to bring data from lots of files in same folder
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-03-2019, 12:52 AM
  2. [SOLVED] VB Code to bring data from monthly sheet
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 06-20-2016, 03:28 AM
  3. VB Code to match data and bring to another sheet.
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-06-2016, 04:28 AM
  4. [SOLVED] VB Code or formula to bring data from other sheet
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-03-2016, 02:50 PM
  5. [SOLVED] Grab data related to array code
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-08-2015, 02:11 PM
  6. vba/code to bring up msg box when critaria is met that contains data from comment box
    By xwarlock10x in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 09-28-2013, 04:11 PM
  7. Need to pull data based on related code
    By MReitz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-23-2011, 04:51 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