+ Reply to Thread
Results 1 to 5 of 5

Line of code not translating from 2003 to 2007

  1. #1
    Forum Contributor
    Join Date
    07-31-2008
    Location
    Berkshire, UK
    MS-Off Ver
    2003 & 2007
    Posts
    118

    Line of code not translating from 2003 to 2007

    Hi there, I am trying to run a macro created in excel 2003 on my 2007 machine.

    I don't know vba unfortunately and when I try to run a macro, I get the debugger. There is no issue with the Macro using xl2003.

    The line of code it highlights, is the following.

    Please Login or Register  to view this content.
    Is there any immediate reason why this line might fail?

    Thank you for your time.
    Last edited by simjambra; 04-22-2010 at 05:55 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Line of code not translating from 2003 to 2007

    There is nothing wrong with that line as it stands I'm afraid.

    How is LastRow declared ?

    In VBE - go to Debug -> Compile Project... do you get any errors ?

    If so check Tools -> References and see if you have any libraries marked as Missing (eg Calendar Control etc...)

  3. #3
    Forum Contributor
    Join Date
    07-31-2008
    Location
    Berkshire, UK
    MS-Off Ver
    2003 & 2007
    Posts
    118

    Re: Line of code not translating from 2003 to 2007

    Hi, thanks for the reply.

    Compile Project didn't do anything. I tried the Tools -> References and it lists the available ones but I notice Calendar control is not there, is this one that should be?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Line of code not translating from 2003 to 2007

    Quote Originally Posted by simjambra
    I notice Calendar control is not there, is this one that should be?
    No, don't fret

    Sometimes pre 2007 files debug when run in 2007 because previously available libraries / controls are no longer available... the Calendar Control is a classic case in point (and often a culprit) given it does not exist in 2007 by default.

    In this case the above is not an issue (nothing denoted as missing).


    You didn't stipulate what the Debug was ... ie the error message itself ... can you ?

    My next question would be that mentioned in the Italics previously - ie how is LastRow declared ?

    If LastRow is declared as Integer and the last used cell in Col N appears after row 32767 you would generate a Debug (overflow) ... best to use Long rather than Integer (in 32 bit VBA Integers are converted to Longs "under the hood" so no gain in using Integer)

  5. #5
    Forum Contributor
    Join Date
    07-31-2008
    Location
    Berkshire, UK
    MS-Off Ver
    2003 & 2007
    Posts
    118

    Re: Line of code not translating from 2003 to 2007

    Aha it was indeed an integer, changed it to a Long and all seems well.

    Thanks for your help.

+ 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