+ Reply to Thread
Results 1 to 12 of 12

Why do I have a compile error?

  1. #1
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Why do I have a compile error?

    Hi ,

    I got a compile error. End If without Block if - I'm flummoxed , any advice?


    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Why do I have a compile error?

    If you place the IF and the THEN on the same line you don't need the END IF.

  3. #3
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Why do I have a compile error?

    You need to change:
    Please Login or Register  to view this content.
    to either:
    Please Login or Register  to view this content.
    Or
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  4. #4
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Why do I have a compile error?

    got this now?????????????
    Attached Images Attached Images
    Last edited by bralew; 10-25-2016 at 09:21 AM.

  5. #5
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Why do I have a compile error?

    It doesn't like the end for some reason

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Why do I have a compile error?

    You appear to have commented out:
    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Why do I have a compile error?

    Hi bralew,

    You have to put the text after the Then on the next line.

    Please Login or Register  to view this content.
    or get rid of the End If (which I highly discourage)
    Please Login or Register  to view this content.
    Even though it takes additional lines of code, I always use the first construction, because I find it a lot easier to debug, because I know I must have an 'End If' for each 'If' statement.

    I hope this helps.

    Lewis

  8. #8
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Why do I have a compile error?

    Ive left out

    Private Sub ComboBox3_Change()

    because that sat the top, it the end statement that I'm having trouble with. I'll try some of the above remedies and get back to you. Gimme a sec, cheers all.

  9. #9
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Why do I have a compile error?

    LJMetzer I've tried your second suggestion and still get this:
    Attached Images Attached Images

  10. #10
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Why do I have a compile error?

    All you have to do to the code you posted originally is remove the END IF (or use the alternative formulation now provided twice).

  11. #11
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Why do I have a compile error?

    I've tried them all, still scratching my head???

  12. #12
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Why do I have a compile error?

    It's ok, I've gone back a version, thank you all

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Compile Error: Wrong number of arguments or invalid property assignment Error
    By JJFletcher in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-22-2016, 05:29 PM
  2. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  3. [SOLVED] Compile Error in Hidden Module and Compile Error: Can't find project or library
    By Taislin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2013, 07:03 PM
  4. [SOLVED] Compile error: Constant expression required error when merging two Codes
    By Kezwick in forum Outlook Programming / VBA / Macros
    Replies: 8
    Last Post: 06-26-2013, 09:32 AM
  5. compile error: compile error expected
    By odeno in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2008, 04:30 PM
  6. Replies: 3
    Last Post: 02-13-2006, 11:30 AM
  7. [SOLVED] VBAProject name compile error, not defined at compile time
    By Matthew Dodds in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-13-2005, 03:20 PM

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