View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Maxi[_2_] Maxi[_2_] is offline
external usenet poster
 
Posts: 94
Default Need help with macro

Dear friends,

I need help in a macro

In an excel file, I have a webquery. I wrote a macro to get certain
details from the webpage. url is http://www.buzzingstocks.com/in/btest.pl?t=SUZLON&f=2
(I want to get "Date" "Last Recommendation" "Return on Investment" &
"Annualized returns" for each company

Sheet1 has the web query. name of the query is "btest"
Sheet2 has folowing data
SYMBOL , NAME OF COMPANY , Date , Type , ROI , AR
20MICRONS , 20 Microns Limited , , , ,
3IINFOTECH , 3i Infotech Limited , , , ,
3MINDIA , 3M India Limited , , , ,
AARTIDRUGS , Aarti Drugs Ltd. , , , ,
AARTIIND , Aarti Industries Ltd. , , , ,
AARVEEDEN , Aarvee Denims & Exports Limited , , , ,
ABAN , Aban Offshore Ltd. , , , ,

Above is a sample data, In all I have 1500 rows of data

I want the macro to fill up the columns C D E F

Here is the macro

Sub Macro1()
Dim ctr As Long
For ctr = 2 To 8 'Cells(Rows.Count, "a").End(xlUp).Row
On Error Resume Next
With Sheet1
With .QueryTables("btest")
.Connection = _
"URL;http://www.buzzingstocks.com/in/btest.pl?" _
& "t=" & Cells(ctr, "a") & "&f=2"
End With
Cells(ctr, "c").Value = .Cells(26, "a").Value
Cells(ctr, "d").Value = .Cells(26, "i").Value
Cells(ctr, "e").Value = .Cells(28, "d").Value
Cells(ctr, "f").Value = .Cells(28, "g").Value
End With
Next ctr
ThisWorkbook.Save
End Sub

Somehow it does not fetches entries for few companies. Please help