Hi,
I've got a problem with a drop-down list. When I choose a number from it, my macros doesn't execute correctly. However, writing the number manually, everything works fine. I have used lign by lign execution and found that an macro I didn't write is the problem.
When using the drop-down list choice, the lign "If Not .On Then Exit Function" exit the whole execution (and not the function), while typing the number, everything works as it should.
BTW, I never execute that function from my VBA code. Instead it's used in 6 cells in my sheet. But I guess that excel recalculate that function each time a cell in the scope of that function get changed.
So, one possible way would be to stop excel to calculate the result of formula while VBA is doing some stuff, how could I do that?
Thanks,
sharky9
EDIT: I'm using Excel 2003.
I've got a problem with a drop-down list. When I choose a number from it, my macros doesn't execute correctly. However, writing the number manually, everything works fine. I have used lign by lign execution and found that an macro I didn't write is the problem.
When using the drop-down list choice, the lign "If Not .On Then Exit Function" exit the whole execution (and not the function), while typing the number, everything works as it should.
Code:
Function AutoFilter_Criteria(Header As Range) As String
Dim strCri1 As String, strCri2 As String
Application.Volatile
With Header.Parent.AutoFilter
With .Filters(Header.Column - .Range.Column + 1)
If Not .On Then Exit Function
strCri1 = .Criteria1
If .Operator = xlAnd Then
strCri2 = " AND " & .Criteria2
ElseIf .Operator = xlOr Then
strCri2 = " OR " & .Criteria2
End If
End With
End With
AutoFilter_Criteria = UCase(Header) & ": " & strCri1 & strCri2
End Function
BTW, I never execute that function from my VBA code. Instead it's used in 6 cells in my sheet. But I guess that excel recalculate that function each time a cell in the scope of that function get changed.
So, one possible way would be to stop excel to calculate the result of formula while VBA is doing some stuff, how could I do that?
Thanks,
sharky9
EDIT: I'm using Excel 2003.
Last edited: