ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   web query peculiar problem (https://www.excelbanter.com/excel-programming/341299-web-query-peculiar-problem.html)

R.VENKATARAMAN

web query peculiar problem
 
I have at least to me a peculiar prolem

my data base is

col A col B
company name yahoocode
ABHISHEK IND ABHP.NS
ADOR WELDING ADOR.NS
AJANTA PHARMA AJPH.NS
AKSH OPTIFIBRE AKSO.NS
ALEMBIC ALMC.NS
ALFA LAVAL I ALFA.NS
ALLAHABAD BK ALBK.NS
ALOK INDUS ALOK.NS
AMTEK AUTO AMTK.NS

my sub is
Dim cell As Range
Dim mystocks As Range
Dim stockone As Range
Dim stocklast As Range

Public Sub download_data()
Application.DisplayAlerts = False
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://in.finance.yahoo.com/d/quotes.csv?s=" & ActiveCell &
"&m=b&f=sl1d1t1c1ohgv&e=.csv" _
, Destination:=ActiveCell.Offset(0, 1))
.Name = "quotes.csv?s=" & ActiveCell & "&m=b&f=sl1d1t1c1ohgv&e="
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With
'ActiveCell.Offset(0, 1).Select
ActiveCell.Offset(0, 1).Select
Selection.TextToColumns Destination:=ActiveCell, DataType:=xlDelimited,
_
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=True, Space:=False, Other:=True, OtherChar
_
:=",", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1),
Array(4, 1), Array(5, _
1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1))

Range("a1").Select
Application.DisplayAlerts = True
End Sub
first my active cell is the first cell after the column head (yahoo code) in
column B and if run the sub I get thedata on col c
when I make the next cell in column B as activecell and run thesub the
corresponding data comes in col C in that row.
etc etc
this works in my computer windows 98SE excel2000

if run the same sub in my borher's computer XP excel 2000 when I activate
the second celll under yahoo code
the data already received in the previous row shifts one cell to the right
when the thrid cell is activated, the first data now in col D shifts one to
right and the second data in col C shifts to D
for each new row cell selected the shift of all the previous row data by one
cell to the right. why?????
my borther has both win98 and xp. when I open the system in win 98 and run
the macro it works perfectly
wherer do I do the mistake.
aplogise for long message.




All times are GMT +1. The time now is 12:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com