Scan Barcode to excel for 3 times only

ygurram

New Member
Joined
Dec 4, 2017
Messages
14
Hi,
I am looking something similar to thread shown below.
https://www.mrexcel.com/forum/excel-questions/672492-scan-barcode-excel-date-time-stamp-out.html.

I am looking for the similar code that hiker has provided in his reply #18 but My way of arranging cells is little different and I need to scan a particular Part number for only 3 times. As you can see below Part number(which needs to be scanned is in D column and cell starts from D3). 1st, 10th & Last are in columns G,H & I( this is where I need time stamps when scanned 3 times)
[TABLE="width: 801"]
<colgroup><col><col span="2"><col><col span="2"><col><col><col></colgroup><tbody>[TR]
[TD]JOB[/TD]
[TD]Does Part Match spec. sheet[/TD]
[TD]Does part # match label?[/TD]
[TD]Part Number[/TD]
[TD]Is PPE required for Part Number?[/TD]
[TD]What is the Country of Origin[/TD]
[TD]1st[/TD]
[TD]10th[/TD]
[TD]Last[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
 
Good morning Hiker,

I am new to Mr.Excel. Do I need to start a new thread or can I share my email ID here so that you send the code?
Please advise.

ygurram

ygurram,

No, you do not have to start a new thread.

As soon as one of the Moderator's is able to fix the problem, then, I will be able to provide the macro code that works as you have described.
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
ygurram,

On both of your threads/posts, I have clicked on the Report button, but, none of the Administrator's have corrected the problem.


unable to correct where No code is posted between code tags, not aware of any system glitches eating code
 
Upvote 0
mole999,

Thanks for your reply.

Code:
I am not able to copy any macro code between the two code tags?
 
Upvote 0
ygurram,

I found a work around.

I had to copy the macro code into a blank worksheet.

Then I added the code tags, below, and, then copied the information in the blank worksheet, into the text between the code tags.


Below is the macro code to solve your request for Sheet1.


Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
2. Select the worksheet in which your code is to run
3. Right click on the sheet tab and choose View Code, to open the Visual Basic Editor
4. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
5. Press the keys ALT + Q to exit the Editor, and return to Excel


Code:
Private Sub Worksheet_Change(ByVal Target As Range)
' hiker95, 12/08/2017, ME1033984
If Intersect(Target, Range("B4:B" & Range("A" & Rows.Count).End(xlUp).Row)) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
Dim sc As Long, nc As Long
With Application
  .EnableEvents = False
  .ScreenUpdating = False
  sc = 12
  If Cells(Target.Row, sc) = vbEmpty Then
    Cells(Target.Row, sc) = Target.Value & " " & Format(Now, "hh:mm")
  Else
    nc = Cells(Target.Row, Columns.Count).End(xlToLeft).Column + 1
    Cells(Target.Row, nc) = Target.Value & " " & Format(Now, "hh:mm")
  End If
  .EnableEvents = True
  .ScreenUpdating = True
End With
End Sub


Then add in the Part Number's in range B4:B500.


Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm, and, answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Last edited:
Upvote 0
mole999,

Thanks for your reply.

Code:
any particular combination of browsers and text editor in use, should be straight forward as you know

I am not able to copy any macro code between the two code tags?

Any particular browser / editor in use ?
 
Upvote 0
mole999,

I think the problem started several days ago, just after the new Windows 10 installation.

The editor is the one in Excel 2007.
 
Upvote 0
ygurram,

I found a work around.

I had to copy the macro code into a blank worksheet.

Then I added the code tags, below, and, then copied the information in the blank worksheet, into the text between the code tags.


Below is the macro code to solve your request for Sheet1.


Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
2. Select the worksheet in which your code is to run
3. Right click on the sheet tab and choose View Code, to open the Visual Basic Editor
4. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
5. Press the keys ALT + Q to exit the Editor, and return to Excel


Code:
Private Sub Worksheet_Change(ByVal Target As Range)
' hiker95, 12/08/2017, ME1033984
If Intersect(Target, Range("B4:B" & Range("A" & Rows.Count).End(xlUp).Row)) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
Dim sc As Long, nc As Long
With Application
  .EnableEvents = False
  .ScreenUpdating = False
  sc = 12
  If Cells(Target.Row, sc) = vbEmpty Then
    Cells(Target.Row, sc) = Target.Value & " " & Format(Now, "hh:mm")
  Else
    nc = Cells(Target.Row, Columns.Count).End(xlToLeft).Column + 1
    Cells(Target.Row, nc) = Target.Value & " " & Format(Now, "hh:mm")
  End If
  .EnableEvents = True
  .ScreenUpdating = True
End With
End Sub


Then add in the Part Number's in range B4:B500.


Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm, and, answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.


Hiker,

This Quote works perfectly. Thanks a ton :)

ygurram
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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