[英]Excel VBA write to active cell
這應該很簡單。 當用戶單擊某個單元格(例如B列中的任何單元格),然后將其串聯時,我想要的只是...
文本字符串“ Update:”日期/時間他們的用戶ID(Application.UserName)
我知道我需要類似的東西:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 1 Then
If Not Intersect(Target, Range("D4")) Is Nothing Then
ActiveCell.Select Environ("UserName")
End If
End If
End Sub
...被寫入該單元格。 例如更新:簡史密斯2015年1月1日00:00
希望有人可以幫助:-)謝謝
對於B列中的任何單元,它將是:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 1 Then
If Not Intersect(Target, Range("B:B")) Is Nothing Then
Target.Value = Target.Value & " Update: " & Environ("username") & " " & Now
End If
End If
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.