我的学校有一个准时电子表格(excel),由成就负责人填写。为了确定他们每天晚上有多少课程,他们将适当数量的X附加到单元格。
这当然需要选择单元格,双击,添加X然后移动到下一个学生...通常他们每天可以输入200多个条目,这是相当耗时的。
我想编写一个点击事件,以便当用户点击(或双击)给定范围内的单元格时,它会自动将X附加到该单元格字符串。
如果可能的话,如果时间过了一个星期,这将节省一笔可笑的金额。
我不得不承认我不确定如何在Excel中启动它,尽管我能胜任VB.NET和VBA for ACCESS。
我知道这可以用大约1000个宏按钮完成,但必须有更好的方法。
My school has a punctuality spreadsheet (excel) which is filled in by the head of achievement.To identify how many lessons they have been late each day they append the appropriate number of X's to the cell.
This of course requires selecting the cell, double clicking, adding the X then moving onto the next of student... typically they can enter over 200 entries a day which is rather time consuming.
I'd like to write an on-click event so that when the user clicks (or double clicks) a cell in a given range it automatically appends an X to that cells string.
Over a week this will save a ridiculous amount if time if it is possible.
I have to admit I'm not certain how to start this in Excel, though I am competent with VB.NET and VBA for ACCESS.
I know this could be accomplished with around 1000 macro buttons but there must be a better way.
最满意答案
打开VBA编辑器,Alt + F11。
在左侧窗口中双击要使用此功能的工作表。
复制粘贴:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Target.Value = "x" ' if you want to replace the value in the cell with x Target.value = Target.Value & "x" ' if you want to add one x to the value of the cell End Sub删除找不到符合您需求的行。
关闭VBA编辑器并将文件另存为宏激活的excel文件(xlsm)。
Open VBA editor, Alt + F11.
Doubleclick on the sheet you want this function on in the window to the left.
Copy paste:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Target.Value = "x" ' if you want to replace the value in the cell with x Target.value = Target.Value & "x" ' if you want to add one x to the value of the cell End SubDelete the row you do not find correct for your needs.
Close VBA editor and save file as macroactivated excel file (xlsm).
更多推荐
发布评论