Created
March 6, 2017 01:13
-
-
Save strickc/e0840888b52fac6b837ea96a4a269759 to your computer and use it in GitHub Desktop.
VBA excel prompt user to select range
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Mutates the range passed in the paramter to a user selected value. | |
' Returns true if range is set, or false if not set (i.e. the user pressed cancel) | |
Function promptForRange(prompt As String, title As String, ByRef res As Range) As Boolean | |
promptForRange = False | |
On Error Resume Next | |
Set res = Application.InputBox(prompt, title, , , , , , 8) | |
On Error GoTo 0 | |
If Not res Is Nothing Then promptForRange = True | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment