Barcode to auto save workbook

fpa93

New Member
Joined
Feb 19, 2016
Messages
17
Guys!!

I do need to save a workbook by only reading a barcode. I mean as I read a barcode it will save automatically the workbook. Is it possible ?

Please help me out .

.. or does somebody has already done it cause I couldn't find a link talking about it.
 
Last edited:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
The work I did with barcode in Excel simply took the input from the scanner and wrote the value in a cell before moving down to the next cell ready for the next read.

Using that method, it would be possible to use a 'Save' barcode to achieve what you want. Use the worksheet change event to detect the value entered into a cell (presumably using the Intersect method in a particular column). Something like:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Intersect(Target, Range("C:C")) Is Nothing Or Target.Cells.Count > 1 Then Exit Sub
'replace C:C with the appropriate range

    If Target.Value = "Save" Then   'Replace 'Save' with the code you have.
        Application.EnableEvents = False
        Target.Value = ""
        ActiveWorkbook.Save
        Application.EnableEvents = True
    End If

End Sub

Incidentally, the above works on the sheet with the worksheet change event if you manually type Save into a cell in column C.
 
Upvote 0
Hey Steve_R thank you a lot, it worked as I wanted. However, I need one more thing I dont need that the cursor goes down when I save it but instead I want it to stay in the same cell. I mean I am updating others cell using the same cell to read differents barcodes so it cannot goes down when I save the previous one cause I will read more ...

Have you done that ?

Thanks in advance.
 
Upvote 0
Hi fpa93,

Try this modification to Steve_R's code, in red.

Howard

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Intersect(Target, Range("[COLOR="#FF0000"]C2[/COLOR]")) Is Nothing Or Target.Cells.Count > 1 Then Exit Sub
    
[COLOR="#FF0000"]'replace C2 with the appropriate cell[/COLOR]

    If Target.Value = "Save" Then   'Replace 'Save' with the code you have.
        Application.EnableEvents = False
        Target.Value = ""
        [COLOR="#FF0000"]Target.Select[/COLOR]
        ActiveWorkbook.Save
        Application.EnableEvents = True
    End If

End Sub
 
Last edited:
Upvote 0
Howard, Thank you a lot it worked. As much I ask more I learn thank you for your attention.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,715
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top