+ Reply to Thread
Results 1 to 3 of 3

Compile Error - If, Then, Else, End IF Process

  1. #1
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    Question Compile Error - If, Then, Else, End IF Process

    Hi All,

    A very simple one here I'm sure but I am getting this error every time I try and use an If function in VBA. I'd like to know the fundamental error of my ways!
    The Code is:

    Please Login or Register  to view this content.
    sPath, FName 2 and sPathFName2 are variables. sPath is the file path and FName 2 is the file name.
    Every time I try and run the above I get 'Compile Error: End If without Block If'

    Any help appreciated as always.
    Cheers,
    Mark
    Last edited by R_S_6; 08-17-2010 at 08:34 AM.

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

    Re: Compile Error - If, Then, Else, End IF Process

    In basic terms - because you have put the result if True on the same line as the test this is deemed "the end" - ie the Else does not apply to the If above, ie:

    Please Login or Register  to view this content.
    is the same as

    Please Login or Register  to view this content.
    in terms of modification

    Please Login or Register  to view this content.
    or replicate the : as you have on the Else - but don't let romperstomper see you !

  3. #3
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    Thumbs up Re: Compile Error - If, Then, Else, End IF Process

    Thank you very much! Very informative. That's something I wont forget now!
    Cheers
    Mark

+ 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