Sunday, February 3, 2019

excel vba - Using VBA to prompt user to select cells (possibly on different sheet)

I'm working in Excel on a VBA project, and want part of my macro to prompt the user to select a range of cells*, which the macro can later do stuff with.




*The type of prompt you get when creating a chart, or using a GUI to insert a function



e.g. here:
Screengrab showing required functionality - the Excel 'Sum' Function Arguments pop-up



and here:
Screengrab showing required functionality - the Excel Function Arguments pop-up



I'm therefor looking for something along the lines of




Sub MyMacro()
MsgBox "Please select data range"

' allow user to select range (as images above)
CreateFunctionArgumentsPrompt()

'do stuff with user selected range of cells
...
End Sub



Is it possible to access built-in Excel functionality to perform what I refer to as: CreateFunctionArgumentsPrompt()



Note: this is similar to SO question excel vba get range of user selected range by mouse but differs in that




  1. I want to use the built in GUI functionality of Excel as displayed above

  2. I need to be able to select and refer to a range on a sheet other than the active worksheet

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...