Results 1 to 3 of 3

Module reveals 4 red lines of red code; what is wrong here?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    06-07-2014
    Posts
    213

    Module reveals 4 red lines of red code; what is wrong here?

    https://excelmate.wordpress.com/2012...-boxes-part-3/

    The above article/site is very informative but when I mimic the example 100%, 4 lines of red are produced in the code, stating that something is not right.

    Essentially the aim is to use the below code:

    Sub RespondToMessage()
    
    Dim Reply as Byte
    
    Reply = MsgBox (“Please select a button”, vbYesNoCancel + vbQuestion _ ,“Respond”)
    
    Select Case Reply
    
              Case Is = 6
    
    MsgBox “You selected ‘Yes’”, , “Well done!”
    
              Case Is = 7
    
    MsgBox “You selected ‘No’”, , “Well done!”
    
              Case Is = 2
    
     MsgBox “You selected ‘Cancel’”, , “Well done!”
    
    End Select
    
    End Sub
    Which will produce the below message boxes when the various buttons are clicked:

    13a.jpg

    However, when the code is entered in a module, 4 lines are red as shown below:

    13b.JPG

    What do you think is wrong here?
    Last edited by chin67326; 01-15-2016 at 09:01 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Code locks cells when inserted in sheet module but returns error in standard module
    By yoda66 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2014, 07:39 AM
  2. A function that reveals the formula of another cell
    By SDruley in forum Excel General
    Replies: 2
    Last Post: 01-03-2012, 01:36 AM
  3. Macro Module Won't Run All Lines in Excel 2007
    By hazza147 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-18-2010, 05:39 AM
  4. how to access Sheet module, normal module, Worbook module to type code
    By alibaba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2009, 07:51 AM
  5. Replies: 4
    Last Post: 12-11-2005, 08:00 PM
  6. .OnAction points to wrong file.module.procedure
    By Datasort in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-30-2005, 08:05 PM
  7. [SOLVED] Run worksheet module code from workbook module?
    By keithb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2005, 12:05 AM
  8. Replies: 1
    Last Post: 04-10-2005, 07:07 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