I am using VBA in Excel (Office 365) on a Windows machine. (I already discovered that virtually none of the main VBA functions work on a Mac).
Firstly, my apologies to all those who say "This question has already been asked". Maybe so, but I have just spent over an hour here and can't find the answer.
I found out how to pass the valuable of a variable TO a function but I just can't do it the other way, from function back to subroutine.
There are some similar questions but the code in the answers is way, way, way beyond my absolute beginner level, and I can't figure it out. I've tried loads of things like using "Option Explicit", "Dim", "Public" and "Private", but I just can't make this code work.
So here's the code. Please can someone re-write it correctly for me?
Sub GetTheValueOfXXX()
getXXX
MsgBox XXX
End Sub
Function getXXX()
XXX = 999
End Function
Thanks to whoever takes pity on me as a complete newbie, and apologies to those who think this is like adding 1 plus 1.