No data was selected to Parse Error

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
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
 
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)
 
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
 
set rng = ActiveSheet.QueryTables(1).resultRange
? rng.Address(external:=True)
[Book1]Deployment!$C$10:$R$19

so change ResultsRange to ResultRange - my typo.
 
Back
Top