+ Reply to Thread
Results 1 to 5 of 5

Compile error: sub or function not defined

  1. #1
    Registered User
    Join Date
    07-30-2012
    Location
    Tirane, Albania
    MS-Off Ver
    Excel 2010
    Posts
    13

    Post Compile error: sub or function not defined

    Hi,

    I am trying to solve one classic problem. Say, there are some excel sheets available in one workbook. All the excel sheets are of same format (same column name but differnt data and number of rows). I want to merge these sheets into one. I'm using a macro but when I try to run it shows the Compile error: Sub or Function not defined and the second statement (Sub CopyData....) highlighted in yellow.


    Please Login or Register  to view this content.
    Last edited by arlu1201; 08-17-2012 at 03:39 AM. Reason: Added code tags

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Compile error: sub or function not defined

    @ Anita7

    Welcome to the forum.

    Please notice that code tags have been added to your post instead of the quote tags. The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

    And your post has been moved from the Introduction area so that it will be seen by those who can offer assistance.

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Compile error: sub or function not defined

    The lastrow function was not defined anywhere, hence the issue. This is your updated code -
    Please Login or Register  to view this content.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Compile error: sub or function not defined

    The Function will be available where you got the code from i.e. Ron de Bruin's site
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    07-30-2012
    Location
    Tirane, Albania
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Compile error: sub or function not defined

    Thank you Arlete )

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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