I have a large list of securities (4000+)where i need to retrieve data from an even longer list of data items(8000+).
I have setup up the macro to read the first itme in the security list then loop down through the data item list until it finds the relevant data item. This is repeated for each of the entries in the security list.
Please see the code for the macro below.
Sub Get_Price_Data()
'
' Get_Price_Data Macro
' Macro recorded 18/04/2005 by u5108
Application.ScreenUpdating = False
Dim Valuation_Sedol As String
Dim Price_Sedol As String
Dim Price As Double
Dim Price_Date As String
Dim Price_Currency As String
Dim ValuationIndex As Integer
Dim PriceIndex As Integer
ValuationIndex = 2
PriceIndex = 2
Sheets("Valuation").Select
Range("A2").Select
Do
Valuation_Sedol = Cells(ValuationIndex, 2)
If Valuation_Sedol <> Cells(ValuationIndex - 1, 2) Then
Sheets("Prices").Select
Range("A2").Select
PriceIndex = 2
Do
Price_Sedol = Cells(PriceIndex, 1)
Price = Cells(PriceIndex, 2)
Price_Date = Cells(PriceIndex, 3)
Price_Currency = Cells(PriceIndex, 4)
PriceIndex = PriceIndex + 1
Loop While Price_Sedol <> Valuation_Sedol
Sheets("Valuation").Select
Else
End If
Cells(ValuationIndex, 4) = Price
Cells(ValuationIndex, 5) = Price_Currency
ValuationIndex = ValuationIndex + 1
Loop While Valuation_Sedol <> ""
End Sub
The problem is that this macro takes 10+ minutes to run. Does anyone have ant ideas how I can get the macro to run faster. I do not want to use vlookup formulas within the sheet.
Bookmarks