vbastruggle
New Member
- Joined
- Mar 12, 2018
- Messages
- 6
I have a simple public function within a module. I am planning to execute the function as a user defined function within a worksheet. For now, I only need to select a cell and get its content. This is not working correctly and I hope someone can enlighten me. The simple code from the function is below. If I execute the code from the VBA editor it works fine and I can see that it does, in fact, select Cell D6 on the Test worksheet. However, if I set up a cell with my user defined formula, the code seems to only select from the cell that was previously selected in the worksheet. Can someone please explain why it would work differently when executed in different ways and what I need to do to get the user defined formula to work.
Sheets("Test").Range("D6").Select
MsgBox Selection.Value
Sheets("Test").Range("D6").Select
MsgBox Selection.Value