I am writing a macro to fetch some "frequency & symbol rates" data from a website.
The data typically looks like this: 22000 5/6
When the query is performed, although the data looks fine on the screen, it has been converted into a fraction. Clicking on the cell reveals it's true nature: 22000.833333333333...
This is a problem, as I would like to read off the last 3 characters as a string "5/6" and use them somewhere else.
My code is below, and was generated with the macro recorder. I have tried formatting the entire worksheet as "Text" before running the code, but this doesn't help. Clicking cell I36 shows it has been changed from "Text" format to "Fraction" format. Oddly enough, the whole numbers in other cells are still formatted as text! Is this a bug?
Bluto
The data typically looks like this: 22000 5/6
When the query is performed, although the data looks fine on the screen, it has been converted into a fraction. Clicking on the cell reveals it's true nature: 22000.833333333333...
This is a problem, as I would like to read off the last 3 characters as a string "5/6" and use them somewhere else.
My code is below, and was generated with the macro recorder. I have tried formatting the entire worksheet as "Text" before running the code, but this doesn't help. Clicking cell I36 shows it has been changed from "Text" format to "Fraction" format. Oddly enough, the whole numbers in other cells are still formatted as text! Is this a bug?
Code:
Sub Webpage()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://en.kingofsat.net/pos-28.2E.php", Destination:=Range("A1"))
.Name = "Web query"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
[COLOR=seagreen].PreserveFormatting = True [/COLOR][COLOR=magenta]'Oh no it isn't...[/COLOR]
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = True
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
Bluto