+ Reply to Thread
Results 1 to 3 of 3

Easy if then question?

  1. #1
    Registered User
    Join Date
    09-04-2006
    Posts
    2

    Easy if then question?

    In my macro I want to see if a particular cell (E2) is empty prior to processing my worksheet, and if so:

    1. Give an error message stating the error
    2. Select cell E2 (so user can complete it)
    3. Exit Sub

    Here's what I have in mind:
    ...
    If IsEmpty(Range("E2")) Then _
    MsgBox ("Please Enter PM Initials") _
    Range("E2").Select _
    Exit Sub
    ...
    But I get a Compile error: Expected: end of statement

    This works:

    If IsEmpty(Range("E2")) Then Exit Sub

    But I need to include the error message and cell selection. I've spent hours searching google and Excel forums but for the life of me I can't figure out the problem. Any help is greatly appreciated.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Cool

    If IsEmpty(Range("E2")) Then
    MsgBox ("Please Enter PM Initials")
    Range("E2").Select
    End If
    End Sub


    They are seperate lines

  3. #3
    Registered User
    Join Date
    09-04-2006
    Posts
    2
    Thanks Dave I knew it was something real easy

+ 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