An implementation of Visual Basic that is built into Microsoft products.
Hello @Helen W ,
This could be related to how Excel recalculates the workbook, rather than the paste line directly calling UNAmeWindows(). Microsoft explains that Excel keeps a dependency tree and calculation chain, so when worksheet data changes, Excel may recalculate formulas that depend on it. Microsoft also explains that VBA worksheet functions can be recalculated by Excel, depending on whether they are volatile or nonvolatile.
In other words, a VBA function can still run even when it is not called directly by the current procedure if Excel is recalculating something that depends on that function somewhere else in the workbook.
So, if UNAmeWindows() is used anywhere in the workbook, for example in a cell formula, a defined name, conditional formatting, or data validation, and then stepping over OutRange = vInArrayF could make Excel recalculate and enter that function, even though your code does not call it directly.
Because this only happens on 3 sheets, I would suggest checking whether those sheets are different in some hidden way. For example:
-
UsedRange - merged cells
- leftover formulas
- sheet-level names
- validation rules
Also, UNAmeWindows() only returns the Windows username, so it would not directly explain why "CORE" is pasted everywhere. That part may be coming from the array itself or from the target range not matching the array correctly.
I would suggest:
- Search the workbook for any use of
UNAmeWindows(). - Compare the 3 failing sheets with one working sheet.
- Check that
vInArrayFandOutRangehave exactly the same size. - Try setting calculation to manual before writing the array.
You could try checking the points above to see if any of them helps narrow it down. If you find anything new, please feel free to comment below and I’ll be happy to help further. If this answer is helpful, you can also follow this guide to leave feedback.
Thank you.