I have a barcode scanner USB plug&play which is giving a string of data in one cell of Excel in this form 4449520450061198001 I want to split this data automatically in different cells everytime my scanner reads the code. Please help.
Regards,
I have a barcode scanner USB plug&play which is giving a string of data in one cell of Excel in this form 4449520450061198001 I want to split this data automatically in different cells everytime my scanner reads the code. Please help.
Regards,
UPDATED
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Const ws_range = "A1:A10"
Dim wb As Workbook
Dim ws As Worksheet
Dim i As Integer, k As Integer
Dim codestr As String
Set wb = ThisWorkbook
Set ws = wb.Sheets("Sheet1")
codestr = Target.Text
If Target <> "" Then
If Not Intersect(Target, Me.Range(ws_range)) Is Nothing Then
With Target
k = Len(codestr)
i = 2
Do Until i = k + 2
ws.Cells(Target.Row, i).Value = Mid(codestr, i - 1, 1)
i = i + 1
Loop
End With
End If
End If
End Sub
I haven't fully tested this but now after a value is inserted into column a it will be split into the cells to the right. Obviously modify A1:A10
to match what you need.