How to delete unused parameter?

MassGuy

New Member
Joined
Mar 26, 2020
Messages
1
Office Version
365
Platform
Windows
Solution found!
Select a cell in your query output. Depending on the format of your query, you may find you need to use a different syntax than that below.
Go to VBA and go to the immediates window.
Type:

set qry = selection.listobject.querytable
qry.parameters.delete

Note - this will delete all your parameters and you will then have to go re-set the ones you want. The next time you refresh, Excel will prompt you for the settings.

I would have thought you could, for example, do qry.parameters(5).delete, but I could not find a way to make that work

it is also helpful to use qry.parameters(1).name = "StartDate" or whatever you want, altho if you re-order or restructure your query, "StartDate" is always going to be the first Parameter, even if you use it for a different purpose, until you rename it.
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,089,529
Messages
5,408,810
Members
403,231
Latest member
FlorianPhil

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top