Er..... base one Color, I would like to update the date only on those not fill with colorSo what is the logic for which cells should be updated and which cells shouldn't?
Option Explicit
Sub fillNoColor()
Dim c As Range
Dim rng As Range
Set rng = Range("A1:A19") 'change range as required
Application.ScreenUpdating = False
For Each c In rng
If c.Interior.ColorIndex <> 6 Then 'change colorindex as required. This is yellow
c.Value = Date
End If
Next c
Application.ScreenUpdating = True
End Sub
maybe this:
Code:Option Explicit Sub fillNoColor() Dim c As Range Dim rng As Range Set rng = Range("A1:A19") 'change range as required Application.ScreenUpdating = False For Each c In rng If c.Interior.ColorIndex <> 6 Then 'change colorindex as required. This is yellow c.Value = Date End If Next c Application.ScreenUpdating = True End Sub
Sub MyDateStamp()
Dim cell As Range
Application.ScreenUpdating = False
For Each cell In Selection
If cell.Interior.Pattern = xlNone Then
cell = Date
End If
Next cell
Application.ScreenUpdating = True
End Sub
Best regard, Really, thanksOK. Try this. If you select the range of cells you want to apply it to and run this, it will put the date in any cell that does not have any color fill (regardless of what color fill you may be using):
So it will work on any selected range and any color fill without having to adjust anything in the code.Code:Sub MyDateStamp() Dim cell As Range Application.ScreenUpdating = False For Each cell In Selection If cell.Interior.Pattern = xlNone Then cell = Date End If Next cell Application.ScreenUpdating = True End Sub