marlonsaveri
Board Regular
- Joined
- Jan 28, 2011
- Messages
- 68
When an error occurs, I use "On error goto" to solve, to prevent code page appears. However, sometime it doesn't works and a 1004 Error appears.
In my case:
1004 error, It is not possible get Average property from WorksheetFunction
WorksheetFunction.Average use to work ok; but, sometimes (I don't know why) the code stops run.
1st. How can I make a check like this?
Because we don't want code page is showed.
2nd. Actually, this is the code. I dont understand it neither; why my labels dont shows decimal numbers, just entires?
In my case:
1004 error, It is not possible get Average property from WorksheetFunction
WorksheetFunction.Average use to work ok; but, sometimes (I don't know why) the code stops run.
1st. How can I make a check like this?
Code:
IF "error does not happen with average function", averagefunction.
Else, don't call average.
2nd. Actually, this is the code. I dont understand it neither; why my labels dont shows decimal numbers, just entires?
Code:
maxi = Format(WorksheetFunction.max(interval), "##0.0000")
mini = Format(WorksheetFunction.min(interval), "##0.0000")
myAverage = Format(WorksheetFunction.Average(interval), "##0.0000")
LabelMax.Caption = "Max: " & maxi
LabelMin.Caption = "Min: " & mini
LabelMed.Caption = "Av: " & myAverage
Last edited: