Cell Calculation taking to long  
Author Message
benned





PostPosted: Wed Jan 26 17:02:11 CST 2005 Top

Excel Programming >> Cell Calculation taking to long

I have a macro on which I use the following code:

ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-3],CATALOG,5,FALSE)"
Columns("E:E").Select
Selection.NumberFormat = "$#,##0.00"
Range("D2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range("D2:E2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.FillDown

How can I get it to only fill down to where the adjacent column to the left
has data in it? Is there a piece of code that I can use to do this? Right
now it is taking approx. 2 min. to fill down and calculate.

Excel201  
 
 
Lonnie





PostPosted: Wed Jan 26 17:02:11 CST 2005 Top

Excel Programming >> Cell Calculation taking to long Emma, if I follow you:

Dim CountData&
Application.Calculation = xlCalculationManual
CountData = ActiveSheet.Cells(Rows.Count, "C").End(xlUp).Row
Range(Cells(2, 4), Cells(CountData, 5)).Select
Range(Cells(2, 4), Cells(CountData, 5)) =
"=VLOOKUP(RC[-3],CATALOG,5,FALSE)"
Selection.NumberFormat = "$#,##0.00"
Application.Calculation = xlCalculationAutomatic

HTH--Lonnie M.

P.S. VLOOKUP's can be slow in and of themselves, but turning the
calculation to manual should help speed up the filling of the cells.