JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,535
- Office Version
- 365
- Platform
- Windows
I have a Sub (ReOrder) that is currently called from an .xlsm workbook by a command button control. It's job is to reorder the values in the cells in a named range.
I'd like to move that code to an add-in module so it can be used by other workbooks and by other VBA code. My plan is to move the actual reordering code to the add-in module and change the ReOrder Sub to read the range of values into an array and call the add-in code to do the reordering.
I have a couple of questions:
I'd appreciate any comments or suggestions.
Thanks
I'd like to move that code to an add-in module so it can be used by other workbooks and by other VBA code. My plan is to move the actual reordering code to the add-in module and change the ReOrder Sub to read the range of values into an array and call the add-in code to do the reordering.
I have a couple of questions:
- Should the add-in code be another Sub or a UDF?
- Should the calling code (ReOrder sub or some other code) pass the array as (a) ByVal and return the reordered array, (b) ByRef, or (c) make it a global variable that the add-in code can access?
I'd appreciate any comments or suggestions.
Thanks