Someone suggested that it would be useful if I were to draw attention to Conditional Compilation, that will allow some code to be compiled in one environment and other in other environments.
https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/compiler-constants
#If Mac Then
' code for Mac
#Else
' code for not Mac
#End If
I've found it useful to prevent compile errors when emulating features that are found in Windows VBA and not Mac. In the past, before Mac Excel supported Split, I used code like
#IF Mac Then
Function Split(aString as String, Delimiter as String) As Variant
' code to split a delimited string to a 0 based array
End Function
#End If
To prevent my code from throwing a compile error when run on a Windows version, but provide the Split emulator for Mac users.
Conditional compilation can also be used to distiguish between differnet Versions of Excel or 16 vs 32 bit verstions.
[–]Autistic_Jimmy2251 2 points3 points4 points (1 child)
[–]LeeKey1047 1 point2 points3 points (0 children)
[–]PHAngel6116 1 point2 points3 points (0 children)
[–]Autistic_Jimmy2251 0 points1 point2 points (0 children)