+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    01-11-2010
    Location
    North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    38

    400 Error For Simple Code

    Hi,

    This code is really simple, but I am getting a 400 error. Essentially, I just want the range to change, depending upon what is in cell A4. Any help is much appreciated. Thank you.

    Sub dropdown()
    ActiveSheet.Name = "Graph Data"
    ThisType = Cells("a4").Value
    Select Case Range("Ranges")
    Case Is = 1
    Range("R32:U36") = "GraphRange"
    Case Is = 2
    Range("R39:T43") = "GraphRange"
    Case Is = 3
    Range("R46:R50") = "GraphRange"
    End Select
    End Sub

  2. #2
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,447

    Re: 400 Error For Simple Code

    Please use Code tags, not Quote tags
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

  3. #3
    Registered User
    Join Date
    01-11-2010
    Location
    North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: 400 Error For Simple Code

    My Apologies.

    Code:
    Sub dropdown()
    ActiveSheet.Name = "Graph Data"
    Cells("a4").Value
    Select Case Range("Ranges")
         Case Is = 1
              Range("R32:U36") = "GraphRange"
         Case Is = 2
              Range("R39:T43") = "GraphRange"
         Case Is = 3
              Range("R46:R50") = "GraphRange"
    End Select
    End Sub

  4. #4
    Forum Moderator romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Alibi
    MS-Off Ver
    All
    Posts
    8,262

    Re: 400 Error For Simple Code

    Which line causes the error? (I assume the missing "ThisType =" in the revised code is just a typo)
    So long, and thanks for all the fish.

  5. #5
    Registered User
    Join Date
    01-11-2010
    Location
    North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: 400 Error For Simple Code

    Yes it was in error. It should read:

    Code:
    Sub dropdown()
    ActiveSheet.Name = "Graph Data"
    Ranges = Cells("a4").Value
    Select Case Range("Ranges")
         Case Is = 1
              Range("R32:U36") = "GraphRange"
         Case Is = 2
              Range("R39:T43") = "GraphRange"
         Case Is = 3
              Range("R46:R50") = "GraphRange"
    End Select
    End Sub
    When I run the debugger, it does not stop anywhere and only comes up with the error. Any suggestions as how to figure out exactly what the issue is?

  6. #6
    Forum Moderator romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Alibi
    MS-Off Ver
    All
    Posts
    8,262

    Re: 400 Error For Simple Code

    Code tags again please...
    So long, and thanks for all the fish.

  7. #7
    Registered User
    Join Date
    01-11-2010
    Location
    North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: 400 Error For Simple Code

    I realized that right after I posted and went back and edited. Trying to break old habits!

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.2.0