Results 1 to 6 of 6

IF Statement and Vlookup, Help Please

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-03-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    211

    IF Statement and Vlookup, Help Please

    Hi All

    is there way of combining these two Macros into one Please ? they run in this sequence,

    Thank you


     Sub IfArgument()
    
        Dim lastRow As Long, i As Long
        Dim ws As Worksheet
    
        Set ws = Sheets(""Sheet1"")
        lastRow = ws.Range(""A"" & Rows.Count).End(xlUp).Row
        With ws
            For i = 1 To lastRow
                           
    
    If Cells(i, 4).Value = "Hire"Then
    Cells(i, 6).Value = ""Band1""
    
      ElseIf Cells(i, 4).Value = "Lease" Then
      Cells(i, 6).Value = "Band2"
     
      ElseIf Cells(i, 4).Value = "cash" And Cells(i, 3).Value = "Tango" Then
      Cells(i, 6).Value = "Band3"
      
      ElseIf Cells(i, 4).Value = "Credit" And Cells(i, 3).Value = "Tango" Then
      Cells(i, 6).Value = "Band4"
      
      ElseIf Cells(i, 4).Value = "cash" And Cells(i, 3).Value = "Mango" Then
      Cells(i, 6).Value = "Band5"
      
    
      ElseIf Cells(i, 4).Value = "Credit" And Cells(i, 3).Value = "Tango" Then
      Cells(i, 6).Value = "Band6"
         
    End If
    
    Next i
        End With
    
    End Sub
     SubVlookupArgument()
    Range("I2:I500000").Formula = "=VLOOKUP(A2, Sheet2!A1:H12, RIGHT(F2)+1, FALSE)"
    Last edited by bimo; 11-25-2014 at 03:06 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] If then statement.. vlookup? I think
    By nyichiban in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-28-2013, 03:30 PM
  2. Replies: 4
    Last Post: 06-01-2012, 10:05 AM
  3. Using a VLOOKUP and IF statement inside an IF statement
    By Isis3 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-08-2011, 07:04 PM
  4. Vlookup If Statement
    By mwgr5 in forum Excel General
    Replies: 5
    Last Post: 08-13-2008, 11:18 AM
  5. [SOLVED] If statement with Vlookup
    By Marty in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-30-2006, 11:20 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