+ Reply to Thread
Results 1 to 6 of 6

Module gets "Compile Error: Sub or Function not defined"

  1. #1
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    78

    Module gets "Compile Error: Sub or Function not defined"

    This code isn't working. I have it in a module. I get the "Compile Error: Sub or Function not defined"

    Please Login or Register  to view this content.
    Please Help!

    Thank you

  2. #2
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    883

    Re: Module gets "Compile Error: Sub or Function not defined"

    Try
    Please Login or Register  to view this content.
    It runs but whether it is what you want is another matter as I doubt the result in RES is what you desire
    Last edited by WasWodge; 09-20-2012 at 09:15 PM.
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  3. #3
    Forum Contributor ptm0412's Avatar
    Join Date
    04-16-2008
    Location
    Vietnam
    MS-Off Ver
    Office 2003 and 2007
    Posts
    129

    Re: Module gets "Compile Error: Sub or Function not defined"

    Hi perducci,
    workbooks("P&L data macro.xls")
    LastRow = Application.CountA(Range("A1:A10000"))

  4. #4
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    883

    Re: Module gets "Compile Error: Sub or Function not defined"

    After reading the post from ptm01412 (I hadn't looked at your Workbook activate line) and with the comment I made at at the end of my last post below is what I suspect you are trying to do.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Module gets "Compile Error: Sub or Function not defined"

    Thanks guys!

  6. #6
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Module gets "Compile Error: Sub or Function not defined"

    I had changed the name of the sub, I'm not sure if that had something to do with it. I re-started excel and used your code WasWodge and it worked! So again, thank you.

+ 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