How to format Excel cells to show only a certain part of the code my scanner scans from certain objects?

1

For ex: When I scan an qr code it shows:

Column A1
vbmsavchjas asdhgaskhdgaskhdg_INX7642854858625

but I am only interest in the last characters:

Column B1
INX7642854858625

I can use afterwards in a helper column the =left formula, but I´wonder if there is another option to show that part of the code while scanning, somehow to filter the code while scanning and return only the desired part in the cell.

Probably some macro code?

Bebelens

Posted 2019-10-15T10:13:21.403

Reputation: 11

Answers

0

Dim OneCell As Range
For Each OneCell in Range("A:A")
    If IsEmpty(OneCell) Then
        Exit For
    Else
        OneCell.Offset(0,1).Value = Split(OneCell.Value, "_")(1)
    End If
Next

Akina

Posted 2019-10-15T10:13:21.403

Reputation: 2 991

Nice contribution. It could be even better if it taught us something by explaining how it works. You also need to say how the OP should go about triggering this code to run in a useful way. – I say Reinstate Monica – 2019-10-15T22:43:08.037