Hi
I have a web page that is a tab delimeted text file, basically a lot of incoming orders. I want to read this into an orders spreadsheet.
I have it reading the data in, but all dates and numbers are being imported as text.
I have read 100 solutions to this, but none of them seem to work. I have tried paste and pastespecial and changing numberformats, but nothing seems to work.
I don't want to have to make the vba know about the format of each column and fix it up. When I just use cut and paste from the browser, and do a Paste special, paste as text, Excel gets all the data as proper dates and numbers etc.
The macro I am using is here:
Main problem is that the dates and numbers are text, which messes up calculations later on.
Secondary problem is that I have to know the width of the incoming data (cols A to U) - it would be better if it didn't have to know that.
Please help!!!
Thanks, Jeremy
I have a web page that is a tab delimeted text file, basically a lot of incoming orders. I want to read this into an orders spreadsheet.
I have it reading the data in, but all dates and numbers are being imported as text.
I have read 100 solutions to this, but none of them seem to work. I have tried paste and pastespecial and changing numberformats, but nothing seems to work.
I don't want to have to make the vba know about the format of each column and fix it up. When I just use cut and paste from the browser, and do a Paste special, paste as text, Excel gets all the data as proper dates and numbers etc.
The macro I am using is here:
Code:
Sub ImportOrders()
'
' ImportOrders Macro
' Import Orders
'
' Keyboard Shortcut: Ctrl+o
'
varResponse = MsgBox("Proceed and import orders? 'No' or 'Yes'", vbYesNo + 256, "Proceed and import orders?")
If varResponse <> vbYes Then Exit Sub
sheetname = ActiveSheet.Name
workbookname = ActiveWorkbook.Name
Workbooks.Open Filename:= _
"http://www.mywebsite.com/ipn.php5"
'Search for any entry, by searching backwards by Rows.
LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
Range("A1", "U" & LastRow).Select
Selection.Copy
' Switch to original sheet
Windows(workbookname).Activate
Worksheets(sheetname).Select
' Move to 3 lines past end of spreadsheet
Dim ix As Long
ix = ActiveSheet.UsedRange.Row - 1 + ActiveSheet.UsedRange.Rows.Count
Cells(ix + 3, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
' ActiveSheet.Paste
Application.CutCopyMode = False
Workbooks("ipn.php5").Close SaveChanges:=False
End Sub
Main problem is that the dates and numbers are text, which messes up calculations later on.
Secondary problem is that I have to know the width of the incoming data (cols A to U) - it would be better if it didn't have to know that.
Please help!!!
Thanks, Jeremy