+ Reply to Thread
Results 1 to 8 of 8

select case multiple conditions

  1. #1
    Forum Contributor
    Join Date
    05-02-2015
    Location
    calgary alberta
    MS-Off Ver
    2012
    Posts
    205

    select case multiple conditions

    hey everyone Im new to vba and creating a code to autofill some financial info, I would like to evaluate the cells in column 4, for a txt, then look in column 5 only for this example for an exact amount, ex"653" then place the specified answer in column 8. here is an example of my code I have so far it is working well just don't know how to evaluate the second condition, the line im having issues with is the last Select case, TD MORTGAGE
    Dim finalrow As Integer
    finalrow = Cells(Rows.Count, 4).End(xlUp).Row
    For i = 48 To finalrow
    Select Case Cells(i, 4).Value
    Case "Great-West Life PAY"
    Cells(i, 8).Value = "GWL PAY"
    Cells(i, 8).Interior.Color = 65535
    Case "MAIL DEPOSIT"
    Cells(i, 8).Value = "RENT PAYMENTS"
    Cells(i, 8).Interior.Color = 65535
    Case "EECOL ELECTRIC"
    Cells(i, 8).Value = "WORK RELATED"
    Cells(i, 8).Interior.Color = 65535
    Case "AVIVA INS"
    Cells(i, 8).Value = "Insurance Auto"
    Cells(i, 8).Interior.Color = 65535
    Case "TD MORTGAGE", Cells(i, 5) = 653
    Cells(i, 8).Value = "mortgage Rockyford"
    Cells(i, 8).Interior.Color = 65535
    End Select
    Next i
    MsgBox ("newly added info has been automaticly updated and highlighted yellow")
    End Sub

  2. #2
    Forum Contributor
    Join Date
    05-02-2015
    Location
    calgary alberta
    MS-Off Ver
    2012
    Posts
    205

    Re: select case multiple conditions

    ah jesus I lost all my indents

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: select case multiple conditions

    Hi Sparky
    Please put your codes between code tag
    try the following ..
    Please Login or Register  to view this content.
    Last edited by YasserKhalil; 05-09-2015 at 10:28 AM.

  4. #4
    Forum Contributor
    Join Date
    05-02-2015
    Location
    calgary alberta
    MS-Off Ver
    2012
    Posts
    205

    Re: select case multiple conditions

    sorry my bad, would you like me to re post, or is what you provided my solution

  5. #5
    Forum Contributor
    Join Date
    05-02-2015
    Location
    calgary alberta
    MS-Off Ver
    2012
    Posts
    205

    Re: select case multiple conditions

    sorry my issue is that I have two separate "TD MORTGAGE' values in column 4, in column 5 they are both different values, based on the values id like to generate different values in column 8

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: select case multiple conditions

    If I got your request then try the following instead of using Select Case
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    05-02-2015
    Location
    calgary alberta
    MS-Off Ver
    2012
    Posts
    205

    Re: select case multiple conditions

    what is the main difference between the two as the new code is working great?, thank you very much

  8. #8
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: select case multiple conditions

    Hi Sparky
    As for select case deal with test expression which is Cells(I, 4).Value only
    But using If is sometimes more flexible ..
    May be some guys can tell us how to use Select Case with the opreator OR !

    Generally it's solved so mark your thread as solved

+ 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] Case If with multiple conditions
    By PennStan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2014, 12:52 PM
  2. [SOLVED] Case Statement with Multiple Conditions
    By ezrizer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-12-2014, 09:13 AM
  3. Using Case Select On Range With Multiple Conditions?
    By alulla in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 07-03-2013, 02:50 PM
  4. More than 3 formatting conditions - select case?
    By HelenW in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 01-08-2009, 04:58 AM
  5. Select case / case is, multiple arguments
    By Werner Rohrmoser in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-03-2006, 07:00 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