Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wrote some scripts in excel 2000 that used web query and yahoo
finance quotes. Trying to run the scripts in Excel 2003 is a nightmare. The script below works fine in excel 2000 but not 2003. Any help is appreciated. Also, does anybody know why you can't enter this url in the new web query window? http://finance.yahoo.com/d/quotes.cs...l1&ignore=.csv TIA Dave This runs through a column of symbols and retrives the last price and puts it in the adjacent column to the right. Sub Yahoo() Do On Error Resume Next x = ActiveCell.Offset(0, -1).Value With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://finance.yahoo.com/d/quotes.csv?s=" & x & "&f=l1&ignore=.csv", _ Destination:=ActiveCell.Offset(0, 0)) .AdjustColumnWidth = False .WebFormatting = xlWebFormattingNone .BackgroundQuery = False .TablesOnlyFromHTML = True .Refresh BackgroundQuery:=False .SaveData = True End With ActiveCell.Offset(1, 0).Select Loop Until IsEmpty(ActiveCell.Offset(0, -1)) End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ok I figured it out..
In excel 2003, a web query to a single cell will also put character Ascii character 32 (" " or space) in the cell directly below. This does not happen in excel 2000 web query. From David McRitchie ( Thanks ) "Not all characters can be visibly displayed in a worksheet cell. For example, embedded control characters like a tab may not appear in a cell. This happens quite frequently when you copy and paste text from the web or a Word document into Excel. The CellView add-in allows you to see the exact characters in a cell, as well as their character codes (in either decimal or hex numbers). " Cell view add-in http://www.cpearson.com/excel/CellView.htm Macro to trim char 32 http://www.mvps.org/dmcritchie/excel/join.htm#trimall Sub TrimALL() 'David McRitchie 2000-07-03 mod 2000-08-16 2005-09-29 join.htm '-- http://www.mvps.org/dmcritchie/excel/join.htm#trimall ' - Optionally reenable improperly terminated Change Event macros Application.DisplayAlerts = True Application.EnableEvents = True 'should be part of Change Event macro If Application.Calculation = xlCalculationManual Then MsgBox "Calculation was OFF will be turned ON upon completion" End If Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Dim cell As Range 'Also Treat CHR 0160, as a space (CHR 032) Selection.Replace What:=Chr(160), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False 'Trim in Excel removes extra internal spaces, VBA does not On Error Resume Next 'in case no text cells in selection For Each cell In Intersect(Selection, _ Selection.SpecialCells(xlConstants, xlTextValues)) cell.Value = Application.Trim(cell.Value) Next cell On Error GoTo 0 Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True End Sub Thanks again David.. Dave Excel 2003 is not my friend |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 query from Access 2000 database | Excel Worksheet Functions | |||
VBA Code works in Excel 2003 but won't work in Excel 2000 | Excel Programming | |||
VBA Code works in Excel 2003 but won't work in Excel 2000 | Excel Programming | |||
Excel 2003 won't run simple code that Excel XP and Excel 2000 will run | Excel Programming | |||
Converting VB Code for Excel 2000 to Excel 2003 | Excel Programming |