Macro_Nerd99
Board Regular
- Joined
- Nov 13, 2021
- Messages
- 61
- Office Version
- 365
I found this formula online that works great to extract a 6 digit code from a cell string: =MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&1234567890)),6)
However, I'm trying to use it in VBA code and extract it from a variable instead.
However, I get a syntax error when attempting this. How do I fix it?
Public Function Employee_ID() As String
Employee_ID =MID(thisworkbook.name,MIN(FIND({0,1,2,3,4,5,6,7,8,9},thisworkbook.name&1234567890)),6)
End Function
However, I'm trying to use it in VBA code and extract it from a variable instead.
However, I get a syntax error when attempting this. How do I fix it?
Public Function Employee_ID() As String
Employee_ID =MID(thisworkbook.name,MIN(FIND({0,1,2,3,4,5,6,7,8,9},thisworkbook.name&1234567890)),6)
End Function