= 20101231 strYrFlag = "Jan-Dec2010" ElseIf Range("D1").Value = ("NOT IN IEDMS") Then Cells(i, 1).Value = Range("H1:J1").Value >= 20101231 strYrFlag = "Jan-Dec2010" ElseIf Range("D1").Value = ("IN DMFAS") Then Cells(i, 1).Value = Range("H1:J1").Value >= 20111231 strYrFlag = "Jan-Dec2011" ElseIf Range("D1").Value = ("NOT IN IEDMS") Then Cells(i, 1).Value = Range("H1:J1").Value >= 20111231 .">
Most valuable professional
  • Hot Topics

Excel Compile error (type mismatch)

Hi Guys! I'm using the looping condition for extraction of years. And heres my code. I having a trouble when i run it. Suggestion or clarification please. Thankss! Sub GetLoans() Dim i As String Dim strYrFlag As String Range("E1").Select For i = 1 To 4876 Range("H1:J1") As Range If Range("D1").Value = ("IN DMFAS") Then Cells(i, 1).Value = Range("H1:J1").Value < 20100000 strYrFlag = "2009Below" ElseIf Range("D1").Value = ("NOT IN IEDMS") Then Cells(i, 1).Value = Range("H1:J1").Value < 20100000 strYrFlag = "2009Below" ElseIf Range("D1").Value = ("IN DMFAS") Then Cells(i, 1).Value = Range("H1:J1").Value >= 20101231 strYrFlag = "Jan-Dec2010" ElseIf Range("D1").Value = ("NOT IN IEDMS") Then Cells(i, 1).Value = Range("H1:J1").Value >= 20101231 strYrFlag = "Jan-Dec2010" ElseIf Range("D1").Value = ("IN DMFAS") Then Cells(i, 1).Value = Range("H1:J1").Value >= 20111231 strYrFlag = "Jan-Dec2011" ElseIf Range("D1").Value = ("NOT IN IEDMS") Then Cells(i, 1).Value = Range("H1:J1").Value >= 20111231

This question generated 25 answers. To proceed to the answers, click here.

This thread is current as of June 16, 2014.

For more resources for Microsoft Excel:

This article includes the following tags:

  • Excel
  • Microsoft Excel