bill351
Board Regular
- Joined
- Jan 19, 2009
- Messages
- 83
Hey Guys n Girls
I was given a VBA solution by Joe4 (thanks heaps Joe) and it does just what it is suppose to do very well. So when I enter a name in column A I get the current date and time of that entry and what Joe fixed for me is when I do a later entry that current date and time is correct and doesn't change any of the previous entries.
However if (in my testing) if I remove a name in Column A I get a Run Time error '13': Type Mismatch. Below is the VBA with the with the debug highlight
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myFirstDataRow As Long
' Specify where the first data row starts
myFirstDataRow = 2
' Check for updates in column A
If (Target.Column = 1) And (Target.Row >= myFirstDataRow) And (Target <> "") Then
' Capture date stamp in column C
Target.Offset(0, 2) = Date
' Capture time stamp in column D
Target.Offset(0, 3) = Time
End If
End Sub
So my obvious question is how would I fix this?
please excuse my ignorance I really struggle with VBA
Cheers
Bill from OZ
I was given a VBA solution by Joe4 (thanks heaps Joe) and it does just what it is suppose to do very well. So when I enter a name in column A I get the current date and time of that entry and what Joe fixed for me is when I do a later entry that current date and time is correct and doesn't change any of the previous entries.
However if (in my testing) if I remove a name in Column A I get a Run Time error '13': Type Mismatch. Below is the VBA with the with the debug highlight
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myFirstDataRow As Long
' Specify where the first data row starts
myFirstDataRow = 2
' Check for updates in column A
If (Target.Column = 1) And (Target.Row >= myFirstDataRow) And (Target <> "") Then
' Capture date stamp in column C
Target.Offset(0, 2) = Date
' Capture time stamp in column D
Target.Offset(0, 3) = Time
End If
End Sub
So my obvious question is how would I fix this?
please excuse my ignorance I really struggle with VBA
Cheers
Bill from OZ
Last edited: