First, you may want to try it this way:
Option Explicit
sub testme()
dim LastRow as long
with worksheets("Call Summary")
lastrow = .cells(.rows.count,"A").end(xlup).row
with .range("q1:Q" & lastrow)
.formula = "=if(a1=""* Rep Summary"",d1,"""")"
.value = .value
end with
end with
end sub
That way, you convert all the cells in that range at one time--instead of
looping through the cells.
#1. In this code:
with worksheets("Call Summary")
lastrow = .cells(.rows.count,"A").end(xlup).row
The objects with dots in front of them (.cells and .rows) refer to the object
that was used in the previous With statement. In this case, worksheets("call
summary").
And cells() has two pieces. The first is the row and the second is the column.
Since there are 65536 rows in that worksheet (and any worksheet), this line:
lastrow = .cells(.rows.count,"A").end(xlup).row
is equivalent to:
lastrow = .cells(65536,"A").end(xlup).row
which could be written as:
lastrow = .range("a65536").end(xlup).row
This is the same thing as selecting A65536 and hitting the End key, then the up
arrow. You'll end up in the last cell in column A that was used.
I like to use .rows.count, since different versions of excel have different
number of rows (xl95 had 16k, xl97-xl2003 had 64k, and the new version will have
a meg of rows). The code won't have to change like: .range("a65536") would
have to.
==========
And you'd only have to "Dim Cell As Range" one time (usually near the top of the
procedure for most people). So you could just drop that second "dim cell as
range" line.
But even better would be to get it all at once--like the sample above.
......
So don't scroll down until you've tried your modification.
Did it look like this?
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
Option Explicit
Sub testme()
Dim LastRow As Long
With Worksheets("Call Summary")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
With .Range("q1:Q" & LastRow)
.Formula = "=if(a1=""* Rep Summary"",d1,"""")"
.Value = .Value
End With
With .Range("D40

" & LastRow)
.Formula _
= "=IF(ISERROR(INDEX('Rep Performance Analysis'!G:G," & _
"MATCH(Summary!C40,'Rep Performance Analysis'!B:B,0))),""""," _
& "INDEX('Rep Performance Analysis'!G:G," _
& "MATCH(Summary!C40,'Rep Performance Analysis'!B:B,0)))"
.Value = .Value
End With
End With
End Sub
======
I use Testme() as names of subroutines--change that to something meaningful.
ps. You put this stuff in "Call Summary", but in the second formula, you
pointed at "Summary". Was that on purpose?