QueryTable, working on First query...but source data is affected on 2nd, 3rd query

pivotpp

New Member
Joined
Jun 23, 2017
Messages
12
Hi all,

Been searching for hours into the wee morning about this but to no avail.


I'm running a QueryTable (first time using this) to scrape some csv info from a webpage...then I format/clean the scraped data.


This works on the first time, but not on the second/third/fourth, etc time. By formatting/cleaning the data, I mean I use a "text to column" macro on the letter T.


After I end the macro. And modify the url/link to do this process for another company, the scraped info is MISSING A T (!!!)


Really strange...I've already ended the macro and I modify the url to do a new scrape...but somehow the scraped/queried data is Missing a T (the "text to column" cutoff point I specified after the first query.


Any ideas on this? Thank you & Much appreciated


Sub Import_CSV_File_From_URL()
' https://www.mrexcel.com/forum/excel-questions/686700-import-csv-file-web-vba.html
Dim URL As String
Dim destCell As Range

URL = "http://mylinkhere.com/company1"


Set destCell = Range("A1")

With destCell.Parent.QueryTables.Add(Connection:="TEXT;" & URL, Destination:=destCell)
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileCommaDelimiter = True
.Refresh BackgroundQuery:=False
End With



Next ... I use a the "text to column' in a macro


For this dataset, I use the letter "T" as a separating point.


Selection.TextToColumns Destination:=ActiveCell, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="T", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top