Results 1 to 2 of 2

Need to Create Error Message Box during Runtime error 1004

Threaded View

  1. #1
    Registered User
    Join Date
    01-10-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    3

    Need to Create Error Message Box during Runtime error 1004

    Hi guys,

    I am using excel to product charts based on how many selections a user makes. i.e. if 5 brands are selected then the user clicks update graph, then the graph will relocate the range and update the graph.

    Sub UpdateGraphs()
    
        ActiveSheet.ChartObjects("Chart 117").Activate
        ActiveChart.ChartArea.Select
        ActiveChart.PlotArea.Select
        ActiveChart.SetSourceData Source:=Sheets("GraphData").Range("A26:Indirect(B24)"), _
            PlotBy:=xlRows
                ActiveChart.ChartArea.Select
        ActiveChart.Legend.Select
        Selection.AutoScaleFont = False
        With Selection.Font
            .Name = "Arial"
            .FontStyle = "Regular"
            .Size = 6
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ColorIndex = xlAutomatic
            .Background = xlAutomatic
        End With
        
        
    End Sub

    That is my what I have so far and it works fine, however if a user selects no brands and clicks update graph then I get the runtime error 1004, as the range becomes invalid, How can I create an error message pop up instead?

    Any help would be great

    Thanks,
    Last edited by Richard Buttrey; 01-14-2013 at 06:27 AM. Reason: No code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1