开发者

Putting today's date in blank cells

开发者 https://www.devze.com 2023-04-06 13:26 出处:网络
I woul开发者_StackOverflow中文版d like a macro that puts today\'s date into all blank cells within a column. If there is a date already in then a cell, then it should skip this row.You can do this wit

I woul开发者_StackOverflow中文版d like a macro that puts today's date into all blank cells within a column. If there is a date already in then a cell, then it should skip this row.


You can do this without VBA, see http://www.contextures.com/xlDataEntry02.html

With code as requested (select your range to populate prior to running)

Sub QuickFill()
Dim rng1 As Range
On Error Resume Next
Set rng1 = Selection.SpecialCells(xlBlanks)
On Error GoTo 0
If Not rng1 Is Nothing Then rng1.Value = Format(Now(), "dd-mmm-yy")
End Sub
0

精彩评论

暂无评论...
验证码 换一张
取 消