+ Reply to Thread
Results 1 to 2 of 2

msgbox: Argument not optional

Hybrid View

  1. #1
    Registered User
    Join Date
    11-16-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    11

    msgbox: Argument not optional

    Hi,

    I want a msgbox to appear if there are blank cells in a range,
    the code below is nearly there, however with teh msgbox I receive:
    'Compile Error: Argument not optional'.
    Many thanks in advance



    Sub budgettemplate()
    
    
    lastrow = ActiveSheet.UsedRange.Rows.Count
    MsgBox lastrow
    
    For i = lastrow To 1 Step -1
    For j = 19 To 1 Step -1
    If Cells(i, j) = "" Then
    Cells(i, j).Interior.ColorIndex = 3
    MsgBox 'You have blank cells, see shaded area'
    
    End If
    Next
    Next
    End Sub

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: msgbox: Argument not optional

    Hi,

    You need to use " rather than ' to indicate the start and end of the string.
    
    MsgBox "You have blank cells, see shaded area"
    Hope that helps,

    Colin

    RAD Excel Blog

+ 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