+ Reply to Thread
Results 1 to 5 of 5

Compile Error - V.Strange

  1. #1
    Registered User
    Join Date
    09-07-2011
    Location
    Derby
    MS-Off Ver
    Excel 2003
    Posts
    2

    Question Compile Error - V.Strange

    Hi There, hoping someone can help me with a confusing issue I am experiencing with a macro.

    I have written the below macro which is used across three reports. This particular macro has been used as my 'beta' version as a work in progress to get it to a stable point before implementing the same changes across the other two reports. I have got this report to a standard and stability now that I want to bring the others in line with it...
    Please Login or Register  to view this content.
    The above is working perfectly and is stable in day to day use, however when I implement the same save method:
    Please Login or Register  to view this content.
    Into the other report i get a compile error....

    This is the report before I put in the If exists function
    Please Login or Register  to view this content.
    And it works as it should, however when I put this in as so...
    Please Login or Register  to view this content.
    I get the compile error...

    Can anyone offer any advice as I have spent many frustrating hours now looking at every line... The compile error seems to have a problem with the sub name CreateNew() however it's confusing as it works fine before the if exists statement is in, the sub name does not change. it seems to stop at If exists, however it works fine in the other macro?

    Hope I have explained this ok!
    Last edited by dskooo1; 09-07-2011 at 12:01 PM. Reason: Solved

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Compile Error - V.Strange

    There is no Exists function in VBA. Have you written your own? If not, use:
    Please Login or Register  to view this content.
    instead.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    09-07-2011
    Location
    Derby
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Compile Error - V.Strange

    Of course... Yes I have written my own. Thankyou for pointing this out. - now just have to find where I have saved the function!!

    Thankyou very much for your help.

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Compile Error - V.Strange

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Compile Error - V.Strange

    Probably it's simpler to copy the activeworkbook.Sheets("MACRO CONTROLS"); it automatically creates a new workbook.
    Formatting the sheet in the new workbook isn't necessary anymore. Probably you only have to remove data in it.

    Please Login or Register  to view this content.
    PS. Avoid using 'activate', 'select' in VBA.



+ 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