Results 1 to 5 of 5

VBA compare with more than one result

Threaded View

  1. #1
    Registered User
    Join Date
    09-15-2004
    Posts
    10

    VBA compare with more than one result

    i am really just beginning VBA after spending alot of time manipulating it. My problem today, I would hope, is an easy solve.


    I am trying to get a compare of the data in column A to do two (or more) things. For now, it is color the cell and a couple to the right and the 2nd part would be to add a category description. The first part is working fine - the part with the color fill. Anytime the case sensitive string ABC is entered, cells in columns A,B,C & D fill green.

    It is getting the compare to put the client category in that is not working. Below, is the part that is working.

    Ideally the D column cell return a category code, like "cli" for client when ABCxxxx is entered.


    _____A________B_________C________D____
    1 | abc123 (fill grn) (fill grn) cli
    2 | def213 - - -
    3 | abc599 (fill grn) (fill grn) cli


    I have tried a bunch of stuff, but I am just hacking at it. Anybody care to assist?

    thanks

    Joe


    Here is the Green Fill code.
    ##############################
    Private Sub worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("a1:a5")) Is Nothing Then _
           Invoices Intersect(Target, Range("a1:a5"))
    End Sub
    
    Sub Invoices(ByVal rng As Range)
    Dim r As Range, myColor As Integer
    For Each r In rng
         myColor = xlNone
         Select Case r.value
    
         Case "ABC" To "ABC999999"
         myColor = 4
         
         End Select
         r.Resize(, 3).Interior.ColorIndex = myColor
    Next
    End Sub
    ##############################


    [/FONT][/FONT]
    [/SIZE]
    Last edited by josephrowan; 08-26-2007 at 03:52 AM.

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