Here's the problem: I have a laser scanner that reads barcodes and regurgitates a value upon a successful reading. When this happens, the serial number (a ~20-digit number) is pasted into the active cell. Pasted, but not entered. I want to know if there's any way to include in the private sub some sort of "If data pasted" statement.
问题在于:我有一个激光扫描仪可以读取条形码,并在成功阅读后重新调整值。发生这种情况时,序列号(一个~20位数字)将粘贴到活动单元格中。粘贴但未输入。我想知道是否有任何方法可以在私有子中包含某种“If data pasted”语句。
The second purpose of the code is to timestamp each entry in the column to the right, like this:
代码的第二个目的是将列中的每个条目加时间戳,如下所示:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A:A")) Is Nothing Then
ActiveCell.Offset(0, 1).Activate
ActiveCell.Value = Now()
ActiveCell.Offset(1, -1).Activate
End If
End Sub
Data won't be inputted rapidly, so the relative cell references shouldn't be a problem.
If you see anything else that could be improved, please don't hesitate to mention it!
数据不会快速输入,因此相对单元格引用不应成为问题。如果您发现其他任何可以改进的内容,请随时提及!
EDIT: Because some have brought it up, this is not a "simple" paste; the data is placed into the formula bar, but it is not entered.
编辑:因为有些人提出来,这不是一个“简单”的粘贴;数据放入公式栏,但不输入。
EDIT 2: Here is another person with my same problem.
编辑2:这是另一个有同样问题的人。
1 个解决方案
#1
0
The barcode reader is just a replacement of the keyboard that types in alphanumerics read from the barcode. The problem is that it does not type the enter key. You may want to check if there is a way to activate this capability in the barcode reader. Example here: https://docs.symbol.com/KanisaPlatform/Publishing/444/ADC-01244_f.SAL_Public.html
条形码阅读器只是键盘的替代品,从条形码中读取字母数字。问题是它没有输入回车键。您可能想要检查是否有办法在条形码阅读器中激活此功能。示例:https://docs.symbol.com/KanisaPlatform/Publishing/444/ADC-01244_f.SAL_Public.html
There does not exist an event exposed by Excel to VBA to pickup keystrokes and eventually changes in the formula bar.
Excel中没有事件向VBA公开以提取键击并最终更改公式栏。
According to this source: http://www.excelforum.com/excel-programming-vba-macros/686972-key-press-event-in-he-formula-bar.html, you cannot capture the keypress event of character typed in the formula bar. The same source describes a possible way to do it involving hacking your way into listening to events getting to the formula bar window via Win32 API. Nothing exciting in there.
根据此来源:http://www.excelforum.com/excel-programming-vba-macros/686972-key-press-event-in-he-formula-bar.html,您无法捕获字符键入的按键事件在公式栏中。相同的源代码描述了一种可能的方法,包括通过攻击事件来通过Win32 API访问公式栏窗口。没有什么令人兴奋的。
#1
0
The barcode reader is just a replacement of the keyboard that types in alphanumerics read from the barcode. The problem is that it does not type the enter key. You may want to check if there is a way to activate this capability in the barcode reader. Example here: https://docs.symbol.com/KanisaPlatform/Publishing/444/ADC-01244_f.SAL_Public.html
条形码阅读器只是键盘的替代品,从条形码中读取字母数字。问题是它没有输入回车键。您可能想要检查是否有办法在条形码阅读器中激活此功能。示例:https://docs.symbol.com/KanisaPlatform/Publishing/444/ADC-01244_f.SAL_Public.html
There does not exist an event exposed by Excel to VBA to pickup keystrokes and eventually changes in the formula bar.
Excel中没有事件向VBA公开以提取键击并最终更改公式栏。
According to this source: http://www.excelforum.com/excel-programming-vba-macros/686972-key-press-event-in-he-formula-bar.html, you cannot capture the keypress event of character typed in the formula bar. The same source describes a possible way to do it involving hacking your way into listening to events getting to the formula bar window via Win32 API. Nothing exciting in there.
根据此来源:http://www.excelforum.com/excel-programming-vba-macros/686972-key-press-event-in-he-formula-bar.html,您无法捕获字符键入的按键事件在公式栏中。相同的源代码描述了一种可能的方法,包括通过攻击事件来通过Win32 API访问公式栏窗口。没有什么令人兴奋的。