[INDENT]Hi, I am new to VBA and have tried to develop the code for finding a specific stock symbol (Column A) from over 4200 symbols from a downloaded csv file, copy the data in in its (specific symbol's) row (in the next 5 columns B to F) to the 3rd blank row in the master workbook (data arranged from Bottom to Top). In the Master workbook each stock symbol has a worksheet with its symbol as the tab e.g. BHP.AX is the tab or sheetname for BHP stock in the Australian Stock Exchange. The downloaded file comes from a subscribed site EODData which provides daily OHLCV (Open/High/Low/Close/Volume) data against each symbol.
My attempt is shown below and it is very primitive. It does not work! I wish to run it from the Master workbook (name:-0PortfolioASXMultipleIB.xlsm) and not from Csv Data file. Please help
Sub Macro0CopyFromCSV()
'Insert a blank row and format it in Master workbook
Rows("3:3").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Rows("4:4").Select
Selection.Copy
Rows("3:3").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select
Range("A1") = ActiveSheet.Name
'Open csv data file downloaded to EODData folder
Dim wb As Workbook
strA = "C:\Users\Wilfred\Documents\EODData\DataClient\ASCII\ASX\ASX_20120510.csv"
Set wb = Workbooks.Open(strA)
Dim cl As Range, rang As Range
Dim sFind As String, FirstAddress As String
Set rng = ActiveSheet.UsedRange
'sFind = "strSheetName"
With rng
Set cl = .Find(sFind, LookIn:=xlValues)
If Not cl Is Nothing Then
FirstAddress = cl.Address
cl.EntireRow.Interior.ColorIndex = 3
cl.EntireRow.Select
End If
End With
Selection.Copy
Windows("0PortfolioASXMultipleIB.xlsm").Activate
Range("A3").Select
ActiveSheet.Paste
Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.Save
End Sub
Display More
[/INDENT]