Hi folks,
Having a really weird problem with a worksheet change event. I'm supposed to have the spreadsheet log which user last amended a row, easy enough, but it's not behaving itself. This is the bit that's causing the problem:
GetDataCol is this UDF
This runs fine when you type a new value into a cell however when you change the cell value with a picklist when it gets to the End Function line rather than going back to the calling procedure it skips to the End Function line of a completely different function. Stepping past this line, or even stopping code execution at that point, causes the VBA window to flicker for a few seconds and then it stops having not made the change.
I've switched off the error handling and it's not throwing out any errors. I've tried recompiling and it still has the same problem.
Is there any reason why selecting data with a picklist should cause this behaviour when typing a value doesn't?
Having a really weird problem with a worksheet change event. I'm supposed to have the spreadsheet log which user last amended a row, easy enough, but it's not behaving itself. This is the bit that's causing the problem:
Code:
If Not Cells(3, Target.Column) Like "*Last Change*" Then
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Cells(Target.Row, GetDataCol("Last Change")) = UCase(Left(Environ$("Username"), 2))
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End If
GetDataCol is this UDF
Code:
Public Function GetDataCol(strFind As String) As Integer
GetDataCol = Application.WorksheetFunction.Match(strFind, Worksheets("Data").Range("3:3"), 0)
End Function
This runs fine when you type a new value into a cell however when you change the cell value with a picklist when it gets to the End Function line rather than going back to the calling procedure it skips to the End Function line of a completely different function. Stepping past this line, or even stopping code execution at that point, causes the VBA window to flicker for a few seconds and then it stops having not made the change.
I've switched off the error handling and it's not throwing out any errors. I've tried recompiling and it still has the same problem.
Is there any reason why selecting data with a picklist should cause this behaviour when typing a value doesn't?