Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel Query - Code problem

I have a query on a spreadsheet that grabs data from a
database on a corporate server. I can manipulate the
results of the query directly on the sheet, but I can't
use code to reference any of the cells. If I try to
select a cell in code, I get an error '1004' - Select
method of range class failed. Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Excel Query - Code problem

I guess there might be more ideas if you posted the code that's giving you a
problem

Regards

Trevor


"Reney Langlois" wrote in message
...
I have a query on a spreadsheet that grabs data from a
database on a corporate server. I can manipulate the
results of the query directly on the sheet, but I can't
use code to reference any of the cells. If I try to
select a cell in code, I get an error '1004' - Select
method of range class failed. Any ideas?



  #3   Report Post  
Posted to microsoft.public.excel.programming
ijb ijb is offline
external usenet poster
 
Posts: 26
Default Excel Query - Code problem

Can you give a sample of the code?

--


"Reney Langlois" wrote in message
...
I have a query on a spreadsheet that grabs data from a
database on a corporate server. I can manipulate the
results of the query directly on the sheet, but I can't
use code to reference any of the cells. If I try to
select a cell in code, I get an error '1004' - Select
method of range class failed. Any ideas?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel Query - Code problem

As I was paging through some of the other postings,
someone gave the advice of using ActiveSheet.Range rather
than just Range.... I tried this and it worked. The new
code is below. I click a button from another sheet, the
embedded query is on the worksheet "Project". The
original code would crash when I tried to select cell A1
with the simple Range("a1").select command. The code
below works. I'm going to go with this for now.

Private Sub cmdUpdate_Click()

Worksheets("project").Select
ActiveSheet.Range("a1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False

-----Original Message-----
Can you give a sample of the code?

--


"Reney Langlois"

wrote in message
...
I have a query on a spreadsheet that grabs data from a
database on a corporate server. I can manipulate the
results of the query directly on the sheet, but I can't
use code to reference any of the cells. If I try to
select a cell in code, I get an error '1004' - Select
method of range class failed. Any ideas?



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with MS Query in Excel Hayeso Excel Discussion (Misc queries) 0 September 27th 06 12:05 PM
Problem Code: Retrieving Stored Access 03 Query Bettergains Excel Discussion (Misc queries) 2 December 7th 04 04:11 PM
Problem with .Background Query option of ODBC Query Shilps Excel Programming 0 April 19th 04 06:41 AM
query (hiding the excel worksheet presently selected with the help of vb code) BrianB Excel Programming 0 April 5th 04 11:38 AM
Code to run an Access query from Excel Kelly[_7_] Excel Programming 3 January 17th 04 04:12 PM


All times are GMT +1. The time now is 01:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"