Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: a macro that checks if there is a value in a cell

  1. #1
    New Member
    Join Date
    Mar 2002
    Location
    n/a
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I would like to create a macro which checks at the beginning if a certain cell has a value. if the cell has a value the macro carries on running as normal, if the cell is blank, a message comes up to tell the user that 'the data isn't verified....' or something like that. help! how do i do this?
    thanx to anyone who can help me. chiao,
    dj_dafad

    p.s. is it something along the lines of this:

    Dim wrong
    If Range("d20") = 0 Then
    wrong = MsgBox("you have not verified that all of the data entered is correct",
    vbExclamation,"verify")
    GoTo FINISH
    End If

  2. #2
    MrExcel MVP
    Colo's Avatar
    Join Date
    Mar 2002
    Location
    Kobe, Japan
    Posts
    1,456
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    2 Thread(s)

    Default

    Hi. How about use "IsEmpty"?

    If isempty(range("D20") then
    msgbox "you have not....."
    end if

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Perth Australia
    Posts
    1,584
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi there

    Try changing it a bit to something like this (insert the macro code you want to run if D20 is not 0 where is says "rest of your macro" (without the quotes)


    If Range("d20") = 0 Then
    MsgBox "you have not verified that all of the data entered is correct", vbExclamation, "verify"
    Exit Sub
    Else
    "rest of your macro"
    End If
    End Sub

    regards
    Derel

  4. #4
    New Member
    Join Date
    Apr 2002
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hello, friend.
    Thank you for your amazing question. I think you are on the right track to solving your problem with the IF function. I am not familiar with the deep dark realms of the evil microsoft's Visual Basic.
    If you wish to proceed and learn this foreign tounge, do so at your own risk. But be warned, demons lurk behind them AND THE MIGHTY VULCANS SHALL NOT SAVE YOU.

    In the words of Captain Kurk of the starship enterprise, peace be with you, friend.

  5. #5
    New Member
    Join Date
    Mar 2002
    Location
    n/a
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    hey, thanks for the help, it works.
    M-Disley, I don't know what your on about, mayby you should lay off the star wars.
    thaks again
    dj_dafad

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •