• Checking the selection! (Excel VBA 2000>)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Checking the selection! (Excel VBA 2000>)

    Author
    Topic
    #409637

    When running a macro to work with a range is triggered while a chart on the worksheet is active, your macro will fail.
    Use the following code to check for a range selection to prevent this error from occurring.

    You can use VBA’s TypeName function to check the Selection.

    Here’s an example:

    If TypeName(Selection)  "Range" Then
        MsgBox "Please select a range of cells!"
        Exit Sub
    Else
    Reply To: Checking the selection! (Excel VBA 2000>)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: