+ Reply to Thread
Results 1 to 3 of 3

VBA error Expected then or goto

  1. #1
    Registered User
    Join Date
    08-07-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    27

    VBA error Expected then or goto

    Hi ,

    I am trying to use this VBA code to make a message box appear when the value in column G16:GX is > 0 and when in column M it says 'Yes'

    If Range("G16:G10000").Value > 0 And
    Range("m16:m10000") = "yes"

    Then MsgBox "Please make sure you have got permission off the relevant product manager for this product"

    End sub

    Can anybody see what is wrong?

    Sam

  2. #2
    Forum Contributor
    Join Date
    08-04-2014
    Location
    Riga
    MS-Off Ver
    2010
    Posts
    579

    Re: VBA error Expected then or goto

    Try putting THEN in the same row as IF

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA error Expected then or goto

    Hi, Sam,

    please have a look at Forum Rule#3 to understand why you are asked to apply code-tags to your procedure.

    You would need to loop through the cells in the ranges as well or use CountIf as well and eiother put the code all in one line or add Then behind the comaprision and close with an End If as well.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ 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. On Error GoTo not working as expected
    By penfold1992 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-29-2013, 08:36 AM
  2. GoTo compile error: "Expected: line number or label"
    By elfsprin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-29-2011, 09:21 PM
  3. Syntax Error and Compile Error: Expected Line Number or Label...
    By AnthonyWB in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-31-2011, 09:59 AM
  4. Run-time error '91' when 'On error goto' and cells.find
    By bjoern in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2008, 07:27 PM
  5. Error Handling - On Error GoTo doesn't trap error successfully
    By David in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2006, 02:10 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