Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TypeName(Selection) (XP/2003 UK)

    Hi,

    Got a small check where I'm trying to secure that the user has in fact selected a chart before firing a formatting macro. Has so far worked fine but testing it now with a range or single cell selected in a worksheet, it does not enter the 'Msgbox' option informing the user of the incorrect selection. Can anybody tell me what's wrong here...??

    Sub CheckSelection
    Debug.Print TypeName(Selection)

    Select Case TypeName(Selection)
    Case "ChartArea", "PlotArea", "Series", "Legend", "Axis", "ChartTitle"
    'Everything's fine do nothing
    Case "Nothing" Or "Range"
    MsgBox "Please click on the chart you want to format before you proceed", vbInformation, CoName
    End Select

    End Sub
    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: TypeName(Selection) (XP/2003 UK)

    What happens if you change the line to:
    <pre>Case "Nothing", "Range"</pre>


    I get an error with that line due to the Or not being text...

    Steve

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TypeName(Selection) (XP/2003 UK)

    Hi,

    Thanks that solved it.
    Hadn't imagined 'Or' to be a 'problem'...
    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •