+ Reply to Thread
Results 1 to 2 of 2

Scan multiple barcodes into a single Excel cell, each on a separate line

Hybrid View

AvalonNYC Scan multiple barcodes into a... 12-16-2014, 10:51 PM
karedog Re: Scan multiple barcodes... 12-17-2014, 04:18 AM
  1. #1
    Registered User
    Join Date
    11-23-2014
    Location
    New York, US
    MS-Off Ver
    2003, 2007, 2010, 2013
    Posts
    2

    Post Scan multiple barcodes into a single Excel cell, each on a separate line

    A library has an Excel sheet that's used as a packing list for books to be loaned to other libraries. Each row represents a single box being packed. The cells of that row have info such as Recipient, Shipment number, Box number, etc.

    In one of the columns they'd like to scan the barcoded "Acquisition Number" of each of the several books that will go in that box, such that each scanned number will appear on a new line in that cell.

    But when they scan a barcode, Excel moves to the next row, since the scanner is programmed to terminate the scanned data with ENTER.

    They cannot reprogram the scanners to remove the ENTER, as they are used for other apps.

    How can we get Excel to:

    If we're in column C
        When Excel detects CR/LF
            If the cell was not empty
                Append a new line to the contents of the cell
            Append the scanned data to the contents of the cell
            Stay in that cell ready for the next scan
    Then they can press an arrow key, if required, to get out of the cell.
    -- adTHANKSvance

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Scan multiple barcodes into a single Excel cell, each on a separate line

    Hi,

    Place this code in worksheet module :

    Private Sub Worksheet_Change(ByVal Target As Range)
      Dim cell As Range, lastInput As Variant
      Set cell = Target.Cells(1, 1)
      If cell.Column = Columns("C").Column Then
         Application.EnableEvents = False
           lastInput = cell.Value
           Application.Undo
           If lastInput <> "" Then
              If cell.Value = "" Then
                 cell.Value = lastInput
              Else
                 cell.Value = cell.Value & vbLf & lastInput
              End If
           End If
         Application.EnableEvents = True
      End If
    End Sub
    But after this sub is running, any attempt to clear/delete the cell will fail because off the logic run in the code, so another code is needed to do this.

    Place this code in standard code module :
    Sub ForceClearContent()
      Application.EnableEvents = False
        Selection.ClearContents
      Application.EnableEvents = True
    End Sub
    You then can call this sub to clear the cell in affected column C.

    Regards
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

+ 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. Scan barcodes, replace cell with next one after print action
    By MaliExcel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2014, 07:36 AM
  2. Replies: 5
    Last Post: 04-10-2014, 06:43 AM
  3. Replies: 6
    Last Post: 11-29-2013, 10:52 PM
  4. Link Word Multiple Line Data into Excel Single Cell
    By mohanvamsi_18 in forum Excel General
    Replies: 0
    Last Post: 01-21-2010, 03:52 AM
  5. [SOLVED] How to Import multiple-line addresses from Word into single cell?
    By Queen Mother in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-21-2006, 01:10 PM

Tags for this Thread

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