I've been able to make a spreadsheet that will put a date stamp in a cell (e.g. Now) when another cell has been populated. Below is the code that I've found and slightly tweaked and it works great as designed. For example, if I type the word "true" in A4, it puts the value of =NOW in cell C6. And the date/time won't change when the file is reopened.
However, I don't want the user to be required to manually type the word "true" (or anything else for that matter) in cell A4. I don't even want an in-cell dropdown. I just want to be able to click a check box that's "floating" in the cell. So I did just that. I placed a checkbox next to cell A4 and linked it to A4. So when the box is checked, "TRUE" shows up in A4 and when I de-select it, "FALSE" is shown.
This is where my problem is. When "TRUE" is placed in cell A4 via checking the box, the macro doesn't recognize anything has happened as if I had manually typed it. Why doesn't the macro pick up the cell value as "TRUE"? It clearly says "TRUE" in A4 and I can reference A4 in a formula just fine (i.e. =A4) BTW, I tried removing the quotes in the code and use True (the VBA parameter?), but no dice.
What am I missing here? Although I might be the office geek people call before calling IT, in this forum I'm certainly a novice compared to most of you. So please bear with me.
*****CODE*****
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Value = "TRUE" Then Exit Sub
If Not Intersect(Target, Range("A4:A100")) Is Nothing Then
With Target(1, 3)
.Value = Now
.EntireColumn.AutoFit
End With
End If
End Sub
-Kkamann
A non-professional geek who's a geek.
However, I don't want the user to be required to manually type the word "true" (or anything else for that matter) in cell A4. I don't even want an in-cell dropdown. I just want to be able to click a check box that's "floating" in the cell. So I did just that. I placed a checkbox next to cell A4 and linked it to A4. So when the box is checked, "TRUE" shows up in A4 and when I de-select it, "FALSE" is shown.
This is where my problem is. When "TRUE" is placed in cell A4 via checking the box, the macro doesn't recognize anything has happened as if I had manually typed it. Why doesn't the macro pick up the cell value as "TRUE"? It clearly says "TRUE" in A4 and I can reference A4 in a formula just fine (i.e. =A4) BTW, I tried removing the quotes in the code and use True (the VBA parameter?), but no dice.
What am I missing here? Although I might be the office geek people call before calling IT, in this forum I'm certainly a novice compared to most of you. So please bear with me.
*****CODE*****
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Value = "TRUE" Then Exit Sub
If Not Intersect(Target, Range("A4:A100")) Is Nothing Then
With Target(1, 3)
.Value = Now
.EntireColumn.AutoFit
End With
End If
End Sub
-Kkamann
A non-professional geek who's a geek.