Forum Discussion

FatManFluff's avatar
FatManFluff
Copper Contributor
Oct 26, 2024

Auto Filtering Blanks

Good afternoon,

Was looking to see if there was a way of matching up numbers from check out to check in column as I enter the info. For example when everyone is checking there stuff back in I don’t want to have look for the radio number to match it up and scan it into that cell. I want to able to scan it on the first row and have it line up on it’s own.

2 Replies

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    FatManFluff 

    If you want Excel to find automatically the row in the "Check In" column based on the "Check Out" entry, you can maybe use the MATCH and INDEX functions.

    =IFERROR(INDEX($A$2:$A$100, MATCH(A2, $B$2:$B$100, 0)), "")

     

    Or a VBA Macro for Auto-Matching Scanned Entries

    Insert this VBA code into the worksheet where your "Check Out" and "Check In" columns are located.

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim checkOutRange As Range
        Dim checkInRange As Range
        Dim checkOutCell As Range
        
        ' Define the range of "Check Out" and "Check In" columns
        Set checkOutRange = Me.Range("A2:A100") ' Adjust range as needed
        Set checkInRange = Me.Range("B2:B100")   ' Adjust range as needed
        
        ' Check if the change was made in the "Check In" column
        If Not Intersect(Target, checkInRange) Is Nothing Then
            ' Loop through the Check Out column to find a match
            For Each checkOutCell In checkOutRange
                If checkOutCell.Value = Target.Value Then
                    ' Match found, place the value in the corresponding "Check In" row
                    Target.Value = checkOutCell.Value
                    Exit For
                End If
            Next checkOutCell
        End If
    End Sub

    This code runs every time a value is entered in the "Check In" column.

    Don’t forget to save your workbook as a macro-enabled workbook (.xlsm) to ensure the macro is saved.

     

    My answers are voluntary and without guarantee!

     

    Hope this will help you.

    • FatManFluff's avatar
      FatManFluff
      Copper Contributor
      Thanks for the reply both the index/match formula and the VBA just keep crashing my excel app. It crash resets every time it runs

Resources