excel-2002 - 如何在Excel中找到事件单元格旁边的单元格

标签 excel-2002

我想在 excel 中创建一个日志文件。

我创建了一个宏,它会在 ButtonInTime 单击时及时插入到事件单元格中。同样,在 ButtonOutTime 上单击事件单元格中的超时时间...

现在我想在 ButtonInTime click in previous cell of active cell 上插入今天的日期

计算总日志小时数并将其插入 OutTime 的下一个事件单元格

我怎样才能做到这一点? 谁能帮帮我???

我试图找出解决方案,但没有找到合适的...

提前致谢....

最佳答案

我实现了..这里面有一些硬代码....

Sub ButtonInTime_Click()
Range("A1").End(xlDown).Select

activecell.Offset(1, 0).Select
activecell.Value = Date
activecell.Offset(0, 1).Value = Time()
activecell.Offset(0, 3).Interior.Color = RGB(255, 0, 0)
activecell.Offset(0, 3).Value = "Log Not Closed!!!"


Range("A" & activecell.Row & ":E" & activecell.Row).Borders(xlEdgeTop).LineStyle = xlContinuous
Range("A" & activecell.Row & ":E" & activecell.Row).Borders(xlEdgeRight).LineStyle = xlContinuous
Range("A" & activecell.Row & ":E" & activecell.Row).Borders(xlEdgeBottom).LineStyle = xlContinuous
Range("A" & activecell.Row & ":E" & activecell.Row).Borders(xlEdgeBottom).LineStyle = xlContinuous

Range("B" & activecell.Row).Borders(xlEdgeRight).LineStyle = xlContinuous
Range("C" & activecell.Row).Borders(xlEdgeRight).LineStyle = xlContinuous
Range("D" & activecell.Row).Borders(xlEdgeRight).LineStyle = xlContinuous
Range("E" & activecell.Row).Borders(xlEdgeRight).LineStyle = xlContinuous

End Sub


Sub ButtonOutTime_Click()
Range("C1").End(xlDown).Select
activecell.Offset(1, 0).Select

activecell.Value = Time()
activecell.Offset(0, 1).Value = activecell.Value - activecell.Offset(0, -1).Value
activecell.Offset(0, 1).Interior.Color = RGB(255, 255, 255)


End Sub

关于excel-2002 - 如何在Excel中找到事件单元格旁边的单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9308795/

相关文章:

web-services - 我可以使用什么方法从 VBA 调用 Web 服务?

excel - Excel中问号的意义是什么?

java - 在单元格上使用 apache poi DataFormatter 时出现错误的日期格式