|
-
March 29th, 2001, 03:24 PM
#1
VBA error
Hi all,
I have the following VBA code in the macro for my Excel SpreadSheet, but the macro is giving an error " RunTime error '1004', Application-defined or object-defined error".
I am on Win2k, MS-Office2K.
Range("B3").Select
Selection.QueryTable.Refresh BackgroundQuery:=false
The error points to the second line i.e. "Selection..."
I would also add that I am a newbee to VB, my strengts lie elsewhere. This was needed to upload some data to the spreadsheet
TIA
Ajay K
-
March 29th, 2001, 04:00 PM
#2
Re: VBA error
Hi Ajay,
I am going to assume that the spreadsheet you are trying to run this macro on contains a table which is linked to an external data source, yes?
If it is then fine, if it isn't the macro won't work. The macro is attempting to refresh the cells in the spreadsheet with the data stored externally. Also you need to make sure that the cell address is part of the table. i.e. If you applied B3 and it is not part of the table Excel will return the message you are getting.
I tried this and it worked first time
Worksheets(1).Range("a1").QueryTable.Refresh
Best of luck
Andy
-
March 29th, 2001, 04:18 PM
#3
Re: VBA error
Andy,
Thanks Man, that really helped. It worked, I was having trouble with the ODBC.
Thanks
Ajay
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|