Hello all. I am getting an error with this code, the test_leng is a constant of 886, yet I can't declare it as a constant either.
Compile Error:
Constant expression required.
Hello all. I am getting an error with this code, the test_leng is a constant of 886, yet I can't declare it as a constant either.
Compile Error:
Constant expression required.
Re: How to use a constant from the WorksheetFunction.Max?
Yo cannot change a constant. test_leng should be declared as a Long
Re: How to use a constant from the WorksheetFunction.Max?
OK royUK I have declared test_leng as long but still get the same error;
Compile Error:
Constant expression required.
Sub Make_a_dyno_file()
Const test_leng As Long = WorksheetFunction.Max(ThisWorkbook.Sheets("Vehicle Data").Range("F:F"))
'=886 in this case
Dim Velocity(0 To test_leng)
End Sub
I then tried using Dim instead of Const, but I got the equals highlighted and the following error;
Compile Error:
Expected: end of statement
Re: How to use a constant from the WorksheetFunction.Max?
Is test_leng always 866, or do you need to for the Max check each time?
If the former:
If the latter:
Re: How to use a constant from the WorksheetFunction.Max?
A Constant has to be just that constant, not changing. Your updated code still tries to change a constant value. See Luke's suggestions.
Don’t have an account yet? Register yourself now and be a part of our community!