Hello, I am new to macros, and to recording them. I created a webquery with 
a parameter that it edits a part of the query based on a cell I select. I 
now have to run this web query 800+ times. So I recorded myself doing it 
with the "Use relative references" checked. But it always puts the webquery 
in the same cell I recorded the macro on, not the in the cell next to the 
cell I select for the web query.

Ex: I have a query run in A2 based on a reference in A1. So, I want the 
macro to run the query by using the information from B1 and put it into B2, 
but it always puts it into A2.

The code!

With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;C:\Users\alillien.ASSOCIATED_NT\AppData\Roaming\Microsoft 
\Queries\990 Finder.iqy" _
, Destination:=Range("$C$576"))
.Name = "990 Finder_284"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingAll
.WebTables = """MainContent_GridView1"""
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
ActiveCell.Offset(2, 0).Range("A1").Select
End Sub

I know it is because of the "Destination:=Range("$C$576")" line, but I 
don't know how to edit it to be relative to my starting point/where I click 
for my adjustable query.

Thank you very much!

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to