Results 1 to 9 of 9

Excel Macro End if

Threaded View

  1. #1
    Registered User
    Join Date
    11-18-2008
    Location
    USA
    Posts
    54

    Excel Macro End if

    Hi I have the following part of a macro. What I need it to do is check if each cell in column U have the value a,b,c,d, or is blank. If it is one of those values (or is blank) then continue on to the rest of my macro. However, if it is not one of those values then create a message box saying which cell it is in, and end the macro.

    I started writing a little below, but got confused at this point.


    Thanks to anyone who can help.


    
    Sub TheSelectCase2()
    
    Dim columnsetting, cell As Range
    
    Dim a, b, c, d As String
    a = "A"
    b = "B"
    c = "C"
    d = "D"
    
    Set columnsetting = Sheets("sheet1").Range(Range("U1"), Range("U65536").End(xlUp))
    
    
    
    For Each cell In columnsetting
    
    If cell.Value <> a Or b Or c Or d Then Exit Sub
    
    
    Next cell
    
    End Sub
    Last edited by b50; 09-15-2010 at 04:13 PM.

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