No data was selected to Parse Error

T

Todd Huttenstine

Hey guys

I have a query on my worksheet and I refresh the data
using the following code...

'Refreshes the Employee Database query before running
formulas
Sheets("Contracts Raw Data").QueryTables("Query from
Employees").Refresh


That works because I tried that code by itself. But when
I put the following code after it, I receive the error:
Run-time error '1004':
No data was selected to parse.

Here is the below code 'It converts column AE to text so
formulas recognize data

Selection.TextToColumns Destination:=Range("AE1"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote,
ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False,
Other:=False, FieldInfo _
:=Array(1, 1)


I even added a 15 second time pause before the columns to
text code begins in an attempt to give the program ample
time to update the query but that even failed. Now you
would think this would work but it doesnt.


Anyone know any tricks or anything that would fix this
problem?


Thank you

Todd Huttenstine
 
T

Tom Ogilvy

Dim rng as Range, rng1 as Range
With Sheets("Contracts Raw Data").QueryTables( _
"Query from Employees")
.Refresh BackgroundQuery:=False
set rng = .ResultsRange
End With
Set rng1 = Intersect(rng, Range("AE1").EntireColumn)
rng1.TextToColumns Destination:=Range("AE1"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote,
ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False,
Other:=False, FieldInfo _
:=Array(1, 1)
 
T

Todd Huttenstine

Hey the code runs and then I get the error "Object doesnt
support this property or method" and it highlights the
below part of the code:

set rng = .ResultsRange
 
T

Tom Ogilvy

set rng = ActiveSheet.QueryTables(1).resultRange
? rng.Address(external:=True)
[Book1]Deployment!$C$10:$R$19

so change ResultsRange to ResultRange - my typo.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top