+ Reply to Thread
Results 1 to 15 of 15

Duplicate Decleration In Current Scope Error

  1. #1
    Registered User
    Join Date
    06-27-2010
    Location
    Shreveport,La
    MS-Off Ver
    Excel 2007
    Posts
    9

    Duplicate Decleration In Current Scope Error

    I keep getting the error "Duplicate Decleration In Current Scope" can anyone help me out?
    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    06-27-2010
    Location
    Shreveport,La
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Duplicate Decleration In Current Scope Error

    Ok I did a little tweaking and got passed the original error...BUT now I am getting a new error which says "Block If without End If"

    Please Login or Register  to view this content.

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Duplicate Decleration In Current Scope Error

    Well, you do declare the variable twice.

    new_obs is first declared as a variant (by omitting the data type), then you declare new_obs as an integer. You do the same with the new_data variable.

    Delete the declarations with no data type setting.

    Then you will find that the code bombs on the line

    Please Login or Register  to view this content.
    What do you actually want to do?

    cheers
    Last edited by shg; 06-27-2010 at 07:29 PM.

  4. #4
    Registered User
    Join Date
    06-27-2010
    Location
    Shreveport,La
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Duplicate Decleration In Current Scope Error

    Creating a application that enters data into a quality control chart.

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Duplicate Decleration In Current Scope Error

    you only close one IF statement here

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-27-2010
    Location
    Shreveport,La
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Duplicate Decleration In Current Scope Error

    ok NOW I get an error which states "expected function or variable" and highlights Range at the top

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Duplicate Decleration In Current Scope Error

    in this line?
    Please Login or Register  to view this content.
    If so, it does not surprise me. What do you want to do in this line of code?

  8. #8
    Registered User
    Join Date
    06-27-2010
    Location
    Shreveport,La
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Duplicate Decleration In Current Scope Error

    At this point I'm so tired and fed up with this I don't even know haha do you see anything that stands out in that code that could be incorrect

  9. #9
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Duplicate Decleration In Current Scope Error

    Sorry, but you'll need to tell me what you want to do.

    As I see it, you are assigning the variable new_obs the result of a comparison between a cell and a selected sheet. This makes no sense whatsoever. Maybe you want

    Please Login or Register  to view this content.
    But I can't read your mind.

  10. #10
    Registered User
    Join Date
    06-27-2010
    Location
    Shreveport,La
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Duplicate Decleration In Current Scope Error

    "set the value of the new_obs variable equal to the value of cell a3 in the qc data worksheet plus 1. (hint use an object reference that includes the object hierarchy from the sheets collection to the range object.)"

    the value in a3 is 20

  11. #11
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Duplicate Decleration In Current Scope Error

    Hmmm ........

    ........do you see anything that stands out in that code that could be incorrect

    Basically everything ......

    I tried breaking down your code, but it is not possible to see your intent.

    You would do best to post a sample workbook showing what you need done

    It should clearly illustrate your problem and not contain any sensitive data.

    Cheers

  12. #12
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Duplicate Decleration In Current Scope Error

    The last quote sounds like a homework assignment.

    Marcol, we're out of here.

  13. #13
    Registered User
    Join Date
    06-27-2010
    Location
    Shreveport,La
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Duplicate Decleration In Current Scope Error

    .................
    Last edited by Bono1083; 06-27-2010 at 08:26 PM.

  14. #14
    Registered User
    Join Date
    06-27-2010
    Location
    Shreveport,La
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Duplicate Decleration In Current Scope Error

    Is asking help on a homework assignment wrong?

  15. #15
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Duplicate Decleration In Current Scope Error

    Look, it looks as if you have a homework assignment, manually wrote some code and now you're using us as the debuggers. It does not work that way. We won't do your homework for you, since you need to do that yourself.

    You are welcome to ask specific questions to specific problems, but you will need to show that you would know how to apply the answer.

    cheers

+ Reply to Thread

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