+ Reply to Thread
Results 1 to 7 of 7

Simple MSGBOX code correction

  1. #1
    Registered User
    Join Date
    04-23-2014
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    25

    Simple MSGBOX code correction

    Dear Friends,
    I have a simple MSGBOX code requirement. In this if the range (No_Data_Range) has a value “add” then user should get the message “ Sorry No Data Allowed”.

    Please Login or Register  to view this content.
    I am getting error object variable or with block variable no set. Also this message should be displayed automatically as "Add" value is displayed in range.

    Thanks,
    Nisha

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Simple MSGBOX code correction

    Sub test()
    Dim No_Data_Range As Range
    If No_Data_Range.Value = "Add" Then
    MsgBox "Sorry No Data Allowed"
    End If


    End Sub
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Simple MSGBOX code correction

    You've declared No_Data_Range but you haven't set it to reference anything, so it will be Nothing.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    04-23-2014
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Simple MSGBOX code correction

    Hi Mike.. still getting the same error i.e. object variable or with block variable no set

    Nisha

  5. #5
    Registered User
    Join Date
    04-23-2014
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Simple MSGBOX code correction

    Hi Norie.. can you please give me the correct code.

    Nisha

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Simple MSGBOX code correction

    Is No_Data_Range a named range?

    Is it only one cell?

  7. #7
    Registered User
    Join Date
    04-23-2014
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Simple MSGBOX code correction

    Noire... No_Data_Range is a range e.g. B:B10

    Thanks,
    Nisha

+ 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] Simple MSGBOX which can work with any existing code
    By omega0010 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-23-2013, 05:18 AM
  2. MsgBox-any help with a simple code plz ?
    By tornado1981 in forum Excel General
    Replies: 2
    Last Post: 04-04-2010, 10:40 AM
  3. Vba Code Correction
    By tromao in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2007, 05:55 PM
  4. [SOLVED] VBA Code Correction
    By RichIT in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-10-2006, 12:10 PM
  5. VBA Code Correction
    By RichIT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2006, 11:35 AM

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