Rufus Clupea
Board Regular
- Joined
- Feb 11, 2019
- Messages
- 85
Hi Folks,
Just a quickie (I think/hope)...
I had a formula in a spreadsheet cell:
=TRUNC(MAX(((MAX(E5-5,(E8-4)))/10),1))
that I needed to move into code, i.e.:
Sheet1.Range("J18") = TRUNC(Max(((Max(E5 - 5, (E8 - 4))) / 10), 1))
The VBE/Compiler doesn't like it in this form.
After reading several similar questions/threads, I've tried:
but I don't think I'm implementing it correctly. (I tried defining it as a function).
I've also tried every combination of the above that I could think of.
I'm stumped.
Just a quickie (I think/hope)...
I had a formula in a spreadsheet cell:
=TRUNC(MAX(((MAX(E5-5,(E8-4)))/10),1))
that I needed to move into code, i.e.:
Sheet1.Range("J18") = TRUNC(Max(((Max(E5 - 5, (E8 - 4))) / 10), 1))
The VBE/Compiler doesn't like it in this form.
After reading several similar questions/threads, I've tried:
- Putting Sheet1.Range and quotes around E5 & E8
- Putting WorksheetFunction. in front of the 2 Maxes
- Using: MyValue = Application.WorksheetFunction.Max()
but I don't think I'm implementing it correctly. (I tried defining it as a function).
Code:
Public Function MyValue()
MyValue = Application.WorksheetFunction.Max()[FONT=verdana]
Sheet1.Range("J18") = TRUNC(MyValue(((Myvalue(E5 - 5, (E8 - 4))) / 10), 1))
[/FONT]
I'm stumped.
Last edited: