+ Reply to Thread
Results 1 to 11 of 11

Add and Remove Inventory with bar code scanner

  1. #1
    Registered User
    Join Date
    02-25-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Add and Remove Inventory with bar code scanner

    I am hoping I can get some help. I found a macro that other say works well that I would like to use, however I cannot get it to run. I paste it in and then the macro isn't there to choose to run. Attached is the basic rough draft of what I need.
    The Macro that I found and wanted to use is below. I am running Excel 2010, not sure if that is the issue or if I am pasting it in wrong or what but its getting very frustrating. Any help would be very much appreciated!

    Private Sub Worksheet_Change(ByVal Target As Range)
    Select Case Target.Address
    Case "$A$4" 'add
    If Target.Value <> "" Then
    On Error Resume Next
    Set xitem = Range("C8", Range("C" & Rows.Count) _
    .End(xlUp)).Find(Range("A4").Value)
    With xitem.Offset(0, -1)
    .Value = .Value + 1
    End With
    On Error GoTo 0
    If xitem Is Nothing Then
    MsgBox "The item scanned is not on the list."
    End If
    Range("A4") = ""
    Range("A4").Select
    End If
    Case "$C$4" 'remove
    If Target.Value <> "" Then
    On Error Resume Next
    Set xitem = Range("C8", Range("C" & Rows.Count).End(xlUp)) _
    .Find(Range("C4").Value)
    With xitem.Offset(0, -1)
    .Value = .Value - 1
    End With
    If xitem Is Nothing Then MsgBox Target & " cannot be found " _
    & "and cannot be removed."
    Range("C4") = ""
    Range("C4").Select
    On Error GoTo 0
    End If
    Case "$E$4" 'find
    If Target.Value <> "" Then
    On Error Resume Next
    Set xitem = Range("C8", Range("C" & Rows.Count).End(xlUp)) _
    .Find(Range("E4").Value)
    If xitem Is Nothing Then
    MsgBox Target & " was not found."
    Range("E4").Select
    End If
    Range("E4") = ""
    xitem.Select
    On Error GoTo 0
    End If
    End Select
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Add and Remove Inventory with bar code scanner

    Hi cthiesen21

    Welcome to the Forum!!

    Firstly, you need to add Code Tags to your Code...it's a Forum Requirement.
    Secondly, the Code needs to be in the Worksheet Module, not a General Module
    Thirdly, the Code in the Workbook has a Title of
    Please Login or Register  to view this content.
    The Title needs to be
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    11-06-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Add and Remove Inventory with bar code scanner

    remove the private. private subs are hidden from the macro menu

  4. #4
    Registered User
    Join Date
    02-25-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Add and Remove Inventory with bar code scanner

    I am still not able to get it to work. I have tried both suggestions and I still cannot get the macro to appear in the list. Thanks for your help, I appreciate it a lot! I have attached the test case again with the changes to the worksheet module. I am sure I am making some stupid little mistake but I just cant figure out where.

    Thanks again in advance for any assistance and my apologies for not posting the code in the correct way. I will make sure in the future to follow the posting rules.

    -Chris
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-06-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Add and Remove Inventory with bar code scanner

    did you try wrapping the call in the click event for the button your making? i think your problem is you can't call the macro directly because it is asking for input "Target As Range"
    not positive but in the file im currently testing i can't see
    Please Login or Register  to view this content.
    in my macro list. if i remove "Cancel As Boolean" it shows up. if you wrap it in the button call you'll still have to supply "Target As Range" in your call.

  6. #6
    Registered User
    Join Date
    02-25-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Add and Remove Inventory with bar code scanner

    hmm, not sure I understand, I am pretty good with excel but just recently started getting into macros so I am still pretty inexperienced with it. I know others have used the code as it is with no issues so I am just wondering maybe if I am pasting in the wrong spot and that is causing the issue? I have no idea.

  7. #7
    Registered User
    Join Date
    11-06-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Add and Remove Inventory with bar code scanner

    i can't verify usage of this code as i run my barcode scanner in comm mode not keyboard wedge mode. the only thing i can say about the code as posted is it is a change event it shouldn't need to be fired manually by a button it should just fire when a change is detected.

  8. #8
    Registered User
    Join Date
    02-25-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Add and Remove Inventory with bar code scanner

    ok, cool. I will give it a try without "running" it. I really appreciate all of your help!!

  9. #9
    Registered User
    Join Date
    02-25-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Add and Remove Inventory with bar code scanner

    I can't thank you enough!!! It worked like a charm, I can't belive it was as simple as doing nothing..hahah. Thank you again for all of your help, this is going to make my life a lot easier!!!

  10. #10
    Registered User
    Join Date
    02-25-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Add and Remove Inventory with bar code scanner

    Now, how do I mark this issue as solved. Can't seem to find it?

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Add and Remove Inventory with bar code scanner

    Hi Chris

    Click on Thread Tools, Select "Mark as Solved"
    You're welcome...glad I could help. Thanks for the Rep.

+ 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. Can Excel be used with a barcode scanner to track inventory?
    By polluxtroy12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-05-2013, 09:43 PM
  2. Trying to track inventory using a barcode scanner in Excel
    By ernht38 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-01-2013, 08:16 AM
  3. Using Excel with bar code scanner for inventory.
    By pracicot in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-28-2012, 11:05 AM
  4. [SOLVED] Inventory code to remove duplicates and sum totals
    By Chilisauce in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2012, 11:41 AM
  5. How to update inventory by scanner
    By gurtej1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-07-2010, 08:49 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